package com.yanqu.road.server.cmd.player;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.biaoju.config.BiaoJuTitleConfig;
import com.yanqu.road.entity.activity.daomu.config.DaoMuActivityConfig;
import com.yanqu.road.entity.activity.daomu.config.DaoMuCurioConfig;
import com.yanqu.road.entity.activity.daomu.enums.DaoMuCurioTypeEnum;
import com.yanqu.road.entity.activity.feast.config.FeastEventConfig;
import com.yanqu.road.entity.activity.feast.config.FeastMissionConfig;
import com.yanqu.road.entity.activity.feast.config.ShanHeFeastConfig;
import com.yanqu.road.entity.activity.feast.data.FeastGridPositionData;
import com.yanqu.road.entity.activity.feast.data.FeastMissionData;
import com.yanqu.road.entity.activity.feast.data.FeastUserBehaviorData;
import com.yanqu.road.entity.activity.feast.data.FeastUserData;
import com.yanqu.road.entity.activity.foxcard.*;
import com.yanqu.road.entity.activity.foxcard.config.*;
import com.yanqu.road.entity.autodata.hotpotjump.HotpotJumpUnit;
import com.yanqu.road.entity.autodata.hotpotjump.UserHotpotJumpGameData;
import com.yanqu.road.entity.autodata.hotpotjump.config.HotpotJumpModelConfig;
import com.yanqu.road.entity.activity.jiuzhou.config.JiuZhouConfig;
import com.yanqu.road.entity.activity.snowgarden.SnowGardenCombTriggerData;
import com.yanqu.road.entity.activity.snowgarden.SnowGardenMapData;
import com.yanqu.road.entity.activity.snowgarden.SnowGardenResultCombData;
import com.yanqu.road.entity.activity.snowgarden.SnowGardenUserData;
import com.yanqu.road.entity.activity.snowgarden.config.SnowGardenConfig;
import com.yanqu.road.entity.activity.washe.config.WasheCardConfig;
import com.yanqu.road.entity.activity.washe.config.WasheConfig;
import com.yanqu.road.entity.activity.washe.data.WasheUserData;
import com.yanqu.road.entity.activity.zhenhuan.GameZhenHuanPromotionData;
import com.yanqu.road.entity.activity.zhenhuan.ZhenHuanPromotionInfo;
import com.yanqu.road.entity.activity.zhenhuan.secondProcess.UserZhenHuanSecondProcessData;
import com.yanqu.road.entity.bag.UseGoodsResult;
import com.yanqu.road.entity.config.beauty.BeautyInfo;
import com.yanqu.road.entity.config.building.BuildingInfo;
import com.yanqu.road.entity.config.fishpond.FishPondItemConfig;
import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.config.patrons.PatronsInfo;
import com.yanqu.road.entity.config.skill.SkillInfo;
import com.yanqu.road.entity.cricket.UserCricketData;
import com.yanqu.road.entity.cricket.config.CricketConfig;
import com.yanqu.road.entity.enums.*;
import com.yanqu.road.entity.enums.activity.chefDuel.eChefDuelActivityType;
import com.yanqu.road.entity.enums.activity.snowgarden.eSnowGardenCombType;
import com.yanqu.road.entity.enums.activity.snowgarden.eSnowGardenMapType;
import com.yanqu.road.entity.enums.activity.snowgarden.eSnowGardenPeriodType;
import com.yanqu.road.entity.enums.feast.eFeastType;
import com.yanqu.road.entity.estatewar.UserEstateWarData;
import com.yanqu.road.entity.musicroom.*;
import com.yanqu.road.entity.player.*;
import com.yanqu.road.entity.union.activitygroup.UnionActivityGroup;
import com.yanqu.road.entity.union.activitygroup.UnionActivityGroupUnion;
import com.yanqu.road.entity.union.activitygroup.UnionActivityGroupUser;
import com.yanqu.road.entity.wingroom.WingRoomFurniture;
import com.yanqu.road.entity.wingroom.WingRoomRegion;
import com.yanqu.road.entity.wingroom.config.WingRoomFurnitureConfig;
import com.yanqu.road.entity.union.cross.CrossUnionMember;
import com.yanqu.road.exception.BusinessException;
import com.yanqu.road.logic.activity.biaoju.BiaoJuConfig;
import com.yanqu.road.logic.activity.chuhan.ChuHanConfig;
import com.yanqu.road.logic.activity.foxcard.FoxCardConfig;
import com.yanqu.road.logic.activity.foxcard.game.*;
import com.yanqu.road.logic.activity.hotpotjump.HotpotJumpConfig;
import com.yanqu.road.logic.activity.hotpotjump.game.HotpotJumpGameLogic;
import com.yanqu.road.logic.activity.hotpotjump.game.JumpBoardGrid;
import com.yanqu.road.logic.activity.zhenhuan.ZhenHuanFirstProcessConfig;
import com.yanqu.road.logic.activity.zhenhuan.ZhenHuanPb;
import com.yanqu.road.logic.activity.zhenhuan.ZhenHuanSecondProcessConfig;
import com.yanqu.road.logic.activity.zhenhuan.ZhenHuanThirdProcessConfig;
import com.yanqu.road.logic.bussiness.config.BuildingBussiness;
import com.yanqu.road.logic.bussiness.player.UserBussiness;
import com.yanqu.road.logic.config.GameConfig;
import com.yanqu.road.logic.helper.ActivityHelper;
import com.yanqu.road.logic.helper.RandomWeightConfigHelper;
import com.yanqu.road.logic.helper.UnionActivityGroupHelper;
import com.yanqu.road.logic.pb.HotpotJumpPb;
import com.yanqu.road.pb.activity.*;
import com.yanqu.road.pb.activity.suitang.SuiTang;
import com.yanqu.road.pb.assistant.AssistantProto;
import com.yanqu.road.pb.common.ConfigProto;
import com.yanqu.road.pb.activity.jiuzhou.CrossJiuZhouProto;
import com.yanqu.road.pb.kuang.Kuang;
import com.yanqu.road.pb.pass.RoadProto;
import com.yanqu.road.pb.union.UnionProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.agent.AgentGeneral;
import com.yanqu.road.server.agent.inter.AgentCricket;
import com.yanqu.road.pb.worldmessage.WorldMessageProto;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.biaoju.ActivityBiaoJuModule;
import com.yanqu.road.server.gameplayer.module.activity.daomu.DaoMuActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.feast.ShanHeFeastModule;
import com.yanqu.road.server.gameplayer.module.activity.foxcard.FoxCardModule;
import com.yanqu.road.server.gameplayer.module.activity.horserun.HorseRunActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.hsisland.HsIslandActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.jinli.JinLiModule;
import com.yanqu.road.server.gameplayer.module.activity.jumppot.HotpotJumpModule;
import com.yanqu.road.server.gameplayer.module.activity.ruishou.RuiShouModule;
import com.yanqu.road.server.gameplayer.module.activity.suoyao.SuoYaoModule;
import com.yanqu.road.server.gameplayer.module.activity.tongbing.ChuHanModule;
import com.yanqu.road.server.gameplayer.module.activity.washe.WasheModule;
import com.yanqu.road.server.gameplayer.module.activity.zhenhuan.ZhenHuanSecondProcessModule;
import com.yanqu.road.server.gameplayer.module.banquet.BanquetModule;
import com.yanqu.road.server.gameplayer.module.chefduel.ChefDuelModule;
import com.yanqu.road.server.gameplayer.module.cricket.CricketMgr;
import com.yanqu.road.server.gameplayer.module.cricket.CricketModule;
import com.yanqu.road.server.gameplayer.module.cricket.test.Cricket;
import com.yanqu.road.server.gameplayer.module.kuang.KuangModule;
import com.yanqu.road.server.gameplayer.module.manor.ManorModule;
import com.yanqu.road.server.gameplayer.module.musicroom.MusicRoomModule;
import com.yanqu.road.server.gameplayer.module.passRoad.PassRoadModule;
import com.yanqu.road.server.gameplayer.module.patrons.CombLeaderModule;
import com.yanqu.road.server.gameplayer.module.patrons.PatronsModule;
import com.yanqu.road.server.gameplayer.module.player.*;
import com.yanqu.road.server.gameplayer.module.vehicle.VehicleModule;
import com.yanqu.road.server.gameplayer.module.verification.VerificationModule;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomChakraModule;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomMessageModule;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomModule;
import com.yanqu.road.server.gameplayer.module.workshop.WorkShopModule;
import com.yanqu.road.server.logic.bag.BaseUseGoods;
import com.yanqu.road.server.logic.mail.MailManager;
import com.yanqu.road.server.manger.ConfigMgr;
import com.yanqu.road.server.manger.MultipleLanguageMgr;
import com.yanqu.road.server.manger.ServerLanguageMgr;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;
import com.yanqu.road.server.manger.activity.apprentice.ApprenticeMgr;
import com.yanqu.road.server.manger.activity.biaoju.BiaoJuConfigMgr;
import com.yanqu.road.server.manger.activity.chefduel.ChefDuelActivityMgr;
import com.yanqu.road.server.manger.activity.daomu.DaoMuActivityMgr;
import com.yanqu.road.server.manger.activity.daomu.DaoMuActivityUser;
import com.yanqu.road.server.manger.activity.feast.ShanHeFeastMgr;
import com.yanqu.road.server.manger.activity.foxcard.FoxCardMgr;
import com.yanqu.road.server.manger.activity.jiuzhou.JiuZhouMgr;
import com.yanqu.road.server.manger.activity.jumppot.HotpotJumpMgr;
import com.yanqu.road.server.manger.activity.snowgarden.SnowGardenMgr;
import com.yanqu.road.server.manger.activity.sonhai.SonHaiActivityMgr;
import com.yanqu.road.server.manger.activity.tongbing.ChuHanMgr;
import com.yanqu.road.server.manger.activity.washe.WasheMgr;
import com.yanqu.road.server.manger.activity.zhenhuan.ZhenHuanConfigMgr;
import com.yanqu.road.server.manger.activity.zhenhuan.ZhenHuanMgr;
import com.yanqu.road.server.manger.config.*;
import com.yanqu.road.server.manger.kuang.KuangMgr;
import com.yanqu.road.server.manger.manor.FishPondMgr;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.server.manger.union.GameUnionActivityGroupMgr;
import com.yanqu.road.server.manger.wingroom.WingRoomConfigMgr;
import com.yanqu.road.server.pb.PlayerPb;
import com.yanqu.road.server.pb.WorldMessagePb;
import com.yanqu.road.server.protocol.*;
import com.yanqu.road.utils.RandomHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralThreadFactory;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

public class DebugHelper {

    private static RandomHelper randomHelper = new RandomHelper();

    /**
     * 发送指令
     *
     * @param player  用户
     * @param content 指令
     */
    public static String gmSend(GamePlayer player, String content) {
        if (!content.startsWith("/")) {
            return content;
        }
        try {
            CommandHelper command = new CommandHelper(content);
            // 通用模块
            common(player, command);

            // 盗墓
            daomu(player, command);

            // 山河乐宴
            feast(player, command);

            chefDuel(player, command);

            // 瓦舍
//            washe(player, command);
            // 蛐蛐系统
            cricket(player, command);
            //妙音坊
            musicRoom(player, command);
            //镖局
            biaoJu(player, command);

            // 商会相关
            union(player, command);

            // 跨服转发
            cross(player, command);

            //狐妖
            foxCard(player, command);

            //小马快跑
            horseRun(player, command);

            //火锅跳棋
            hotpotJump(player, command);

            //新财神密卷
            wealthScroll(player, command);

            // 活动通用指令
            activity(player, command);

            return "【" + content + "】" + (command.isFinish() ? command.getResult() : "无效指令");
        } catch (Exception e) {
            e.printStackTrace();
            return "【" + content + "】" + "异常指令,异常信息:" + e.getMessage();
        }
    }

    private static void wealthScroll(GamePlayer player,CommandHelper command){
        if (!command.getCommand().startsWith("/wealth")) {
            return;
        }

        if (command.getCommand().equals("/wealthStart")){
            player.getModule(SecretVolumeModule.class).getUserSecretVolume().setStartDate(0);
            player.getModule(SecretVolumeModule.class).resetSecretVolume();
            player.getModule(WealthScrollModule.class).init();
        }
        if (command.getCommand().equals("/wealthNext")){
            player.getModule(WealthScrollModule.class).getUserData().setStartTime(0);
            player.getModule(WealthScrollModule.class).init();
        }


    }

    private static void horseRun(GamePlayer player,CommandHelper command) {
        if (!command.getCommand().startsWith("/horse")){
            return;
        }
        if (command.getCommand().equals("/horseAddExp")){
            player.getModule(HorseRunActivityModule.class).addExp(Long.valueOf(command.getParam()),1);
            command.setFinish(true);
        }
        if (command.getCommand().equals("/horseSetPoint")){
            player.getModule(HorseRunActivityModule.class).getUserBaseData().setAttrPoint(Integer.valueOf(command.getParam()));
            command.setFinish(true);
        }
        if (command.getCommand().equals("/horseSetDraw")){
            player.getModule(HorseRunActivityModule.class).getUserBaseData().setTurnTableRemain(Integer.valueOf(command.getParam()));
            command.setFinish(true);
        }
        if (command.getCommand().equals("/horseTest")){
            player.getModule(HorseRunActivityModule.class).runSkillTest();
        }

    }

    private static void chefDuel(GamePlayer player, CommandHelper command) {
//        ChefDuelActivityMgr.

//        player.getModule(ChefDuelModule.class).get
    }


    private static void feast(GamePlayer player, CommandHelper command) {
        FeastUserData userData = player.getModule(ShanHeFeastModule.class).getUserData();
        if(userData == null){
            return;
        }
        if (command.getCommand().equals("/feastPower")){
            player.getModule(ShanHeFeastModule.class).updatePowerVal(Long.valueOf(command.getParam()));
            command.setFinish(true);
        }
        if (command.getCommand().equals("/feastStateId")){
            userData.setStateId(Integer.valueOf(command.getParam()));
            command.setFinish(true);
        }
        if (command.getCommand().equals("/feastPracticeVal")){
            userData.setPracticeVal(Long.valueOf(command.getParam()));
            command.setFinish(true);
        }
        if (command.getCommand().equals("/feastItem")){
            Property property = PropertyHelper.parseStringToProperty(command.getCommand());
            if(!property.isNothing()){
                userData.getItems().addProperty(property);
                command.setFinish(true);
            }
        }
        String param = command.getParam();
        if (command.getCommand().equals("/feastHp")){
            ShanHeFeastModule module = player.getModule(ShanHeFeastModule.class);
            module.getUserData().getProperty().getAttrMap().put(eFeastType.BattleAttrType.Hp.getValue(), Long.valueOf(param));
            module.syncUserData();
            command.setFinish(true);
        }
        //通关
        if (command.getCommand().equals("/feastMiss")){
            ShanHeFeastModule module = player.getModule(ShanHeFeastModule.class);
            Map<Integer, FeastMissionData> missionMap = module.getMissionMap();
            int missionId = Integer.parseInt(param);
            ShanHeFeastConfig config = ShanHeFeastMgr.getConfig();
            FeastMissionConfig paramMissionCfg = config.getMissionConfigMap().get(missionId);
            FeastMissionData missionData = missionMap.get(missionId);
            if(missionData == null){
                // 更新内存数据
                missionData = new FeastMissionData();
                missionData.setActivityId(config.getActivityInfo().getActivityId());
                missionData.setUserId(userData.getUserId());
                missionData.setMissionType(paramMissionCfg.getType());
                missionData.setMissionId(paramMissionCfg.getId());
                missionData.setHasExploreGridList(new ArrayList<>());
                missionData.setMissionId(paramMissionCfg.getId());
                missionData.setInsertOption();
                missionMap.put(paramMissionCfg.getId(), missionData);
            }
            if(missionData.getIsFinish()){
                return;
            }
            Property totalReward = new Property();
            for (Integer eventId : paramMissionCfg.getEventIdList()) {

                FeastGridPositionData positionData = null;
                for (FeastGridPositionData data : missionData.getHasExploreGridList()) {
                    if(data.getId() == eventId){
                        positionData = data;
                        break;
                    }
                }
                if(positionData == null){
                    positionData = new FeastGridPositionData();
                    positionData.setFinishStatus(2);
                    positionData.setId(eventId);
                    missionData.getHasExploreGridList().add(positionData);
                }
                if(positionData.getFinishStatus() != 2) {
                    String rewards = null;
                    FeastEventConfig eventCfg = config.getEventConfigMap().get(eventId);
                    if (eventCfg.getType() == eFeastType.EventType.Select.getValue()) {
                        String[] rewardArray = eventCfg.getRewards().split("\\|");
                        rewards = rewardArray[0];
                    }else {
                        rewards = PropertyHelper.parsePropertyToString(RandomWeightConfigHelper.getProperty(eventCfg.getRewards()));
                    }
                    positionData.setFinishStatus(2);


                    //给奖励
                    Property rewardProperty = PropertyHelper.parseStringToProperty(rewards);
                    // 道具奖励（去掉非正常道具）
                    Property itemProperty = new Property();
                    for (Map.Entry<Integer, BigInteger> entry : rewardProperty.getGoods().entrySet()) {
                        int gId = entry.getKey();
                        BigInteger value = entry.getValue();
                        GoodsInfo goodsInfo = GoodsMgr.getGoodsById(gId);
                        if(goodsInfo != null){
                            itemProperty.addProperty(gId, value);
                        }
                    }
                    totalReward.addProperty(rewardProperty);
                    FeastUserBehaviorData behaviorData = null;
                    int canGetBehaviorAwardCount = -1;       // 可以领取奖励的值
                    if (eFeastType.EventType.isTaskEvent(eventCfg.getType())) {
                        String behaviorKey = null;
                        String[] paramArray = eventCfg.getEventParameter().split("\\|");
                        if (eventCfg.getType() == eFeastType.EventType.KillMonster.getValue()) {
                            int behaviorParam = Integer.parseInt(paramArray[0]);
                            canGetBehaviorAwardCount = Integer.parseInt(paramArray[1]);
                            behaviorKey = module.getBehaviorKey(missionId, eFeastType.MissionBehaviorType.KillMonster.getValue(), behaviorParam);
                        } else if (eventCfg.getType() == eFeastType.EventType.GetItem.getValue()) {
                            int behaviorParam = Integer.parseInt(paramArray[1]);
                            canGetBehaviorAwardCount = Integer.parseInt(paramArray[0]);
                            behaviorKey = module.getBehaviorKey(missionId, eFeastType.MissionBehaviorType.GetItem.getValue(), behaviorParam);
                        }
                        behaviorData = module.getBehaviorMap().get(behaviorKey);
                    }
                    //统计事件
                    if (eFeastType.EventType.isBattleEvent(eventCfg.getType())) {
                        // 战斗事件统计行为
                        module.npcEventBehaviorStat(paramMissionCfg.getId(), rewardProperty.getGoods());
                    } else if (eFeastType.EventType.isTaskEvent(eventCfg.getType())) {
                        // 任务事件扣除数量
                        if (behaviorData != null) {
                            behaviorData.setCount(behaviorData.getCount() - canGetBehaviorAwardCount);
                        }
                    }
                }
                userData.setUpdateOption();
            }
            player.getModule(CurrencyModule.class).addCurrency(totalReward, eLogMoneyType.FeastActivity, eLogMoneyType.FeastActivityEventAwardGet);
            missionData.setIsFinish(true);
            module.syncUserData();
            command.setFinish(true);
        }

    }

    private static void union(GamePlayer player, CommandHelper command) throws Exception {
        if (command.isFinish()) {
            return;
        }
        String commandStr = command.getCommand();
        String param = command.getParam();
        if (commandStr.startsWith("/unionCreate")) {
            // 创建商会
            unionCreate(player);
            command.setResult("创建商会成功");
            return;
        } else if (commandStr.startsWith("/unionJoin")) {
            // 加入商会
            unionJoin(player, param);
            command.setResult("加入商会成功");
            return;
        } else if (commandStr.equals("/batchUnionJoin")) {
            // 批量加入创建/加入商会
            ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 4, new GeneralThreadFactory("loadUser"));
            String[] split = param.split("#");
            int openIdStart = Integer.parseInt(split[0]);
            int openIdEnd = Integer.parseInt(split[1]);
            for (int index = openIdStart; index <= openIdEnd ; index++) {
                String openId = String.format("%d", index);
                List<UserInfo> userInfoList = UserBussiness.getUserInfoList(openId);
                if (userInfoList.isEmpty()) {
                    continue;
                }
                UserInfo userInfo = userInfoList.get(0);
                if (!StringUtils.isNullOrEmpty(userInfo.getUnionUid())) {
                    // 有商会的不处理
                    continue;
                }
                threadPool.submit(() -> {
                    GamePlayer gamePlayer = GamePlayerMgr.getPlayer(userInfo.getUserId());
                    if (gamePlayer != null) {
                        // 10%的用户创建商会，90%加入商会
                        if (randomHelper.next(1, 101) <= 10) {
                            try {
                                unionCreate(gamePlayer);
                            } catch (Exception e) {

                            }
                        } else {
                            try {
                                unionJoin(gamePlayer, "");
                            } catch (Exception e) {

                            }
                        }
                    }
                });
            }
            threadPool.shutdown();
            command.setResult("【批量加入创建/加入商会】 用户加载成功");
        }
    }

    /**
     * 创建商会
     */
    private static void unionCreate(GamePlayer player) throws Exception {
        if (player == null) {
            return;
        }
        if (!StringUtils.isNullOrEmpty(player.getUserInfo().getUnionUid())) {
            throw new Exception("已经加入商会");
        }
        // 添加点元宝、vip经验
        Property addProperty = new Property(GameConfig.GAME_MONEY_INGOTS, randomHelper.next(10000, 300000));
        addProperty.addProperty(new Property(GameConfig.GAME_MONEY_VIPEXP, randomHelper.next(10000, 300000)));
        player.getModule(CurrencyModule.class).addCurrency(addProperty, eLogMoneyType.GM, eLogMoneyType.GM);

        // 创建商会
        UnionProto.CrossUnionCreateReqMsg.Builder crossReq = UnionProto.CrossUnionCreateReqMsg.newBuilder();
        crossReq.setQqCode("");
        crossReq.setWechatCode("");
        crossReq.setInnerNotice("沒有最強的商會，只有最團結的商會！記得每日建設拿獎勵！");
        crossReq.setOutNotice("歡迎加入我們，共同建設商會！");
        crossReq.setIsAllowRandomJoin(true);
        crossReq.setUnionFlag(5);
        crossReq.setUnionName("union" + randomHelper.next(1, 999999));
        crossReq.setPlayerBaseData(PlayerPb.parsePlayerBaseTempMsg(player.getUserInfo()));
        player.sendPacket(Protocol.C_UNION_CREATE, crossReq);

        // 聊天发一下
        player.sendPacket(Protocol.S_WORLD_CHAT, WorldMessageProto.WorldChatReqMsg.newBuilder()
                .setType(1).setContent("创建商会成功"));

        player.getModule(CurrencyModule.class).addCurrency(new Property(GameConfig.GAME_ITEM_UNION_EXP, randomHelper.next(1, 99999999)), eLogMoneyType.GM, eLogMoneyType.GM);
    }

    private static void unionJoin(GamePlayer player, String unionId) throws Exception {
        // 随机加入商会
        if (!StringUtils.isNullOrEmpty(player.getUserInfo().getUnionUid())) {
            throw new Exception("已经加入商会");
        }
        UnionProto.UnionJoinGameToCrossMsg.Builder gameToCrossMsg = UnionProto.UnionJoinGameToCrossMsg.newBuilder();
        gameToCrossMsg.setUnionUid(unionId);
        gameToCrossMsg.setPlayerBaseData(PlayerPb.parsePlayerBaseTempMsg(player.getUserInfo()));
        player.sendPacket(Protocol.C_UNION_JOIN, gameToCrossMsg);

        // 聊天发一下
        player.sendPacket(Protocol.S_WORLD_CHAT, WorldMessageProto.WorldChatReqMsg.newBuilder()
                .setType(1).setContent("随机加入商会成功"));
    }

    private static void musicRoom(GamePlayer player, CommandHelper helper) {
        if (helper.isFinish()) {
            return;
        }
        String command = helper.getCommand();
        String param = helper.getParam();
        MusicRoomModule musicRoomModule = player.getModule(MusicRoomModule.class);
        if (command.equals("/mrsetprosperity")) {
            int setProsperity = Integer.parseInt(param);
            player.getModule(AttributeModule.class).setAttribute(ePlayerAttrType.MusicRoomTotalProsperity, setProsperity);
            helper.setResult(String.format("妙音坊 设置繁荣度%d", setProsperity));
            return;
        }

        if (command.equals("/mrcheckin")) {
            String[] split = param.split("=");
            int beautyId = Integer.parseInt(split[0]);
            int buildId = Integer.parseInt(split[1]);

            player.sendPacket(GameProtocol.S_MUSIC_ROOM_BEAUTY_CHECK_IN, MusicRoomProto.MusicRoomBeautyCheckInReqMsg.newBuilder().setBuildId(buildId).setBeautyId(beautyId));
            helper.setResult(String.format("妙音坊 美女%d 入住%d", beautyId, buildId));
            return;
        }

        if (command.equals("/mrtest")) {
            UserMusicRoomBeautyData beautyData = musicRoomModule.getBeautyData(103300);
            beautyData.setComfort(0);
            beautyData.setMood(0);
            beautyData.setSatiety(0);
            MusicRoomRoutingBeauty musicRoomRoutingBeauty = new MusicRoomRoutingBeauty(beautyData);
            musicRoomRoutingBeauty.reduceComfort(100);
            musicRoomRoutingBeauty.addComfort(5);
//            musicRoomModule.calcBeautyRouting();
//            musicRoomModule.stageBeautyShow(Collections.singletonList(103300));
//            musicRoomModule.sendMainScene();
//            for (UserMusicRoomBuildingData buildingData : musicRoomModule.getBuildingDataMap().values()) {
//                Property expBookProduce = PropertyHelper.randomPropertyByListList(buildingData.getProduceExpBookList());
//                Property supportProduce = PropertyHelper.randomPropertyByListList(buildingData.getProduceSupportItemList());
//                if (!expBookProduce.isNothing()){
//                    String content = String.format("建筑=%d,每次产出经验书,%s",
//                            buildingData.getBuildId(), PropertyHelper.parsePropertyToString(expBookProduce));
//                    WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
//                    player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
//                }
//                if (!supportProduce.isNothing()){
//                    String content = String.format("建筑=%d,每次产出应援物,%s",
//                            buildingData.getBuildId(), PropertyHelper.parsePropertyToString(supportProduce));
//                    WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
//                    player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
//                }
//            }
//            helper.setResult(String.format("妙音坊 请求主场景,当前时辰=%d", MusicRoomConfigMgr.getNowTimeNumber()));
//            int beautyId = 103300;
//            BeautyInfo beautyInfo = BeautyMgr.getBeautyInfo(beautyId);
//            UserMusicRoomBeautyData beautyData = new UserMusicRoomBeautyData(player.getUserId(), beautyId);
//            MusicRoomConfigMgr.calcBeautyAttr(beautyData, beautyInfo, beautyInfo.getQuality());
//            helper.setResult("妙音坊 美女属性计算");
            return;
        }

        if (command.equals("/mrtimeback")) {
            Integer passNum = Integer.valueOf(param);
            long timeForward = BigInteger.valueOf(passNum).multiply(BigInteger.valueOf(GameConfig.MUSIC_ROOM_HOUR_REALITY_TIME)).multiply(BigInteger.valueOf(1000)).longValue();
            for (UserMusicRoomBeautyData beautyData : musicRoomModule.getBeautyDataMap().values()) {
                if (beautyData.getLiveInBuildId() == 0) {
                    continue;
                }
                beautyData.setComfort(0);
                beautyData.setMood(0);
                beautyData.setSatiety(0);

                beautyData.setLastTimerEndTime(MusicRoomConfigMgr.getNowTimeNumberStartTime() - timeForward);
                beautyData.setLiveInTime(beautyData.getLastTimerEndTime() + 10000);
                beautyData.setScheduleListType(0);
                beautyData.setScheduleList(MusicRoomConfigMgr.getLifeScheduleList());
                int checkInTimeNumber = MusicRoomConfigMgr.getTimeNumberByTime(beautyData.getLiveInTime());
                int schedule = beautyData.getSchedule(checkInTimeNumber);
                UserMusicRoomBuildingData buildingData = MusicRoomConfigMgr.searchBuildingByScheduleType(musicRoomModule.getBuildingDataSortList(schedule), schedule, false);
                if (buildingData == null) {
                    buildingData = musicRoomModule.getBuildingDataMap().get(beautyData.getLiveInBuildId());
                }
                beautyData.setNowBuildingId(buildingData.getBuildId());
                int nextScheduleType = beautyData.getSchedule(checkInTimeNumber + 1);
                UserMusicRoomBuildingData nextBuildingData = MusicRoomConfigMgr.searchBuildingByScheduleType(musicRoomModule.getBuildingDataSortList(nextScheduleType), nextScheduleType, true);
                if (nextBuildingData == null) {
                    nextBuildingData = musicRoomModule.getBuildingDataMap().get(beautyData.getLiveInBuildId());
                }
                beautyData.setNextBuildingId(nextBuildingData.getBuildId());
                //打印美女当前行程数据
//                MusicRoomConfigMgr.getLogger().info("妙音坊 美女={},当前时辰={},入住时辰={},当前建筑={},下一个建筑={},当前行程={},下一个行程={}",
//                        beautyData.getBeautyId(), MusicRoomConfigMgr.getNowTimeNumber(), checkInTimeNumber, buildingData.getBuildId(), nextBuildingData.getBuildId(), schedule, nextScheduleType);
                String content = String.format("美女=%d,当前时辰=%d,入住时辰=%d,当前建筑=%d,下一个建筑=%d,当前行程=%d,下一个行程=%d",
                        beautyData.getBeautyId(), MusicRoomConfigMgr.getNowTimeNumber(), checkInTimeNumber, buildingData.getBuildId(), nextBuildingData.getBuildId(), schedule, nextScheduleType);
                WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            }
            musicRoomModule.initCheckInBuildingBeauty();

            helper.setResult(String.format("妙音坊 美女计算时辰往前调%d个时辰", passNum));
            return;
        }

        if (command.equals("/mrrouting")) {
            String[] split = param.split("=");
            int checkInTimeNumber = Integer.parseInt(split[0]);
            int passAmount = Integer.parseInt(split[1]);
            String content = "";
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessageProto.WorldMessageTempMsg.newBuilder();
            if (checkInTimeNumber != 0) {
                content = String.format("计算入住时辰=%d,往后经过=%d 时辰后的结果",
                        checkInTimeNumber, passAmount);
                msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

                int passNum = 0;
                if (MusicRoomConfigMgr.getNowTimeNumber() > checkInTimeNumber) {
                    passNum = MusicRoomConfigMgr.getNowTimeNumber() - checkInTimeNumber;
                } else {
                    passNum = MusicRoomConfigMgr.getNowTimeNumber() + GameConfig.MUSIC_ROOM_ALL_TIME_NUMBER - checkInTimeNumber;
                }
                long timeForward = BigInteger.valueOf(passNum).multiply(BigInteger.valueOf(GameConfig.MUSIC_ROOM_HOUR_REALITY_TIME)).multiply(BigInteger.valueOf(1000)).longValue();
                ; //计算时间往前调整的毫秒数
                for (UserMusicRoomBeautyData beautyData : musicRoomModule.getBeautyDataMap().values()) {
                    if (beautyData.getLiveInTime() == 0) {
                        continue;
                    }

                    beautyData.setLastTimerEndTime(MusicRoomConfigMgr.getNowTimeNumberStartTime() - timeForward);
                    beautyData.setLiveInTime(beautyData.getLastTimerEndTime() + 10000);
                    beautyData.setScheduleListType(0);
                    beautyData.setScheduleList(MusicRoomConfigMgr.getLifeScheduleList());

                    int schedule = beautyData.getSchedule(checkInTimeNumber);
                    UserMusicRoomBuildingData buildingData = MusicRoomConfigMgr.searchBuildingByScheduleType(musicRoomModule.getBuildingDataSortList(schedule), schedule, false);
                    if (buildingData == null) {
                        buildingData = musicRoomModule.getBuildingDataMap().get(beautyData.getLiveInBuildId());
                    }
                    beautyData.setNowBuildingId(buildingData.getBuildId());
                    int nextScheduleType = beautyData.getSchedule(checkInTimeNumber + 1);
                    UserMusicRoomBuildingData nextBuildingData = MusicRoomConfigMgr.searchBuildingByScheduleType(musicRoomModule.getBuildingDataSortList(nextScheduleType), nextScheduleType, true);
                    if (nextBuildingData == null) {
                        nextBuildingData = musicRoomModule.getBuildingDataMap().get(beautyData.getLiveInBuildId());
                    }
                    beautyData.setNextBuildingId(nextBuildingData.getBuildId());

                    content = String.format("美女=%d,入住时辰=%d,当前建筑=%d,下一个建筑=%d,当前行程=%d,下一个行程=%d",
                            beautyData.getBeautyId(), checkInTimeNumber, buildingData.getBuildId(), nextBuildingData.getBuildId(), schedule, nextScheduleType);
                    msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                    player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
                }

            } else {
                musicRoomModule.calcBeautyRouting();
                content = String.format("计算当前时辰=%d,往后经过=%d 个时辰后的结果",
                        MusicRoomConfigMgr.getNowTimeNumber(), passAmount);
                msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            }

            MusicRoomRoutingResult calcResult = MusicRoomConfigMgr.calcBeautyRouting(musicRoomModule.getSortLivingBeautyList(),
                    musicRoomModule.getBuildingDataMap(), passAmount, checkInTimeNumber);

            content = String.format("建筑总产出=%s",
                    PropertyHelper.parsePropertyToString(calcResult.getAmountReward()));
            msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

            for (Map.Entry<Integer, List<List<Integer>>> entry : calcResult.getBeautyRoutingMap().entrySet()) {
                Integer beautyId = entry.getKey();
                List<List<Integer>> routingList = entry.getValue();
                List<Integer> typeList = calcResult.getBeautyRoutingTypeMap().get(beautyId);
                for (int i = 0; i < routingList.size(); i++) {
                    Integer type = typeList.get(i);
                    List<Integer> list = routingList.get(i);
                    content = String.format("美女=%d,%s,行程列表=%s",
                            beautyId, type == 0 ? "生活行程" : "工作行程", StringUtils.listToString(list, ","));
                    msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                    player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
                }
            }

            helper.setResult(String.format("妙音坊 美女路线计算"));
            return;
        }

        if (command.equals("/mrpasstime")) {//妙音坊 结算指定时辰过后的结果
            String[] split = param.split("=");
            int passAmount = Integer.parseInt(param);
            String content = "";
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessageProto.WorldMessageTempMsg.newBuilder();
            {
                musicRoomModule.calcBeautyRouting();
                content = String.format("计算当前时辰=%d,往后经过=%d 个时辰后的结果,并结算",
                        MusicRoomConfigMgr.getNowTimeNumber(), passAmount);
                msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            }
            List<UserMusicRoomBeautyData> beautyDataList = musicRoomModule.getSortLivingBeautyList();
            MusicRoomRoutingResult calcResult = MusicRoomConfigMgr.calcBeautyRouting(beautyDataList,
                    musicRoomModule.getBuildingDataMap(), passAmount, MusicRoomConfigMgr.getNowTimeNumber());

            //结果赋值
            for (MusicRoomRoutingBeauty routingBeauty : calcResult.getBeautyMap().values()) {
                UserMusicRoomBeautyData beautyData = musicRoomModule.getBeautyData(routingBeauty.getBeautyId());
                long oldComfort = beautyData.getComfort();
                long oldMood = beautyData.getMood();
                long oldSatiety = beautyData.getSatiety();

                beautyData.setComfort(routingBeauty.getComfort());
                beautyData.setMood(routingBeauty.getMood());
                beautyData.setSatiety(routingBeauty.getSatiety());
                beautyData.setScheduleListType(routingBeauty.getScheduleListType());
                beautyData.setScheduleList(routingBeauty.getScheduleList());
                beautyData.setNowBuildingId(routingBeauty.getNowBuildingId());
                beautyData.setNextBuildingId(routingBeauty.getNextBuildingId());

                content = String.format("美女=%d, 舒适度从=%d,获得=%d,消耗=%d,变为=%d," +
                                "心情值从=%d,获得=%d,消耗=%d,变为=%d," +
                                "饱食度从=%d,获得=%d,消耗=%d,变为=%d",
                        beautyData.getBeautyId(), oldComfort, routingBeauty.getTotalAddComfort(), routingBeauty.getTotalReduceComfort(), beautyData.getComfort(),
                        oldMood, routingBeauty.getTotalAddMood(), routingBeauty.getTotalReduceMood(), beautyData.getMood(),
                        oldSatiety, routingBeauty.getTotalAddSatiety(), routingBeauty.getTotalReduceSatiety(), beautyData.getSatiety());
                msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            }

            for (MusicRoomRoutingBuilding routingBuilding : calcResult.getBuildingMap().values()) {
                UserMusicRoomBuildingData buildingData = musicRoomModule.getBuildingDataMap().get(routingBuilding.getBuildId());
                buildingData.addAmountReward(routingBuilding.getAmountReward());
                buildingData.setWaitCheckInBeautyIds(routingBuilding.getWaitCheckInBeautyIds());
                buildingData.setNowCheckInBeautyIds(routingBuilding.getNowCheckInBeautyIds());
            }

            //更新结算时间
            for (UserMusicRoomBeautyData beautyData : beautyDataList) {
                beautyData.setLastTimerEndTime(MusicRoomConfigMgr.getNowTimeNumberStartTime());
            }
            musicRoomModule.syncBeautyData(beautyDataList);

            for (Map.Entry<Integer, List<List<Integer>>> entry : calcResult.getBeautyRoutingMap().entrySet()) {
                Integer beautyId = entry.getKey();
                List<List<Integer>> routingList = entry.getValue();
                List<Integer> typeList = calcResult.getBeautyRoutingTypeMap().get(beautyId);
                content = String.format("美女=%d,行程列表变化=%s",
                        beautyId, StringUtils.listToString(typeList, "->"));
                msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
                for (int i = 0; i < routingList.size(); i++) {
                    Integer type = typeList.get(i);
                    List<Integer> list = routingList.get(i);
//                    content = String.format("美女=%d,%s,行程列表=%s",
//                            beautyId, type == 0 ? "生活行程" : "工作行程", StringUtils.listToString(list, ","));
//                    msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
//                    player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
                }
            }

            content = String.format("建筑总产出=%s",
                    PropertyHelper.parsePropertyToString(calcResult.getAmountReward()));
            msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

            helper.setResult(String.format("妙音坊 美女路线计算并产出结束"));
            return;
        }

        if (command.equals("/mrsetrouting")) {//指定行程列表
            String[] split = param.split("=");
            int beautyId = Integer.parseInt(split[0]);
            int type = Integer.parseInt(split[1]);
            List<Integer> scheduleList = StringUtils.stringToIntegerList(split[2], ",");

            if (beautyId == 0){
                for (UserMusicRoomBeautyData beautyData : musicRoomModule.getLivingBeautyList()) {
                    beautyData.setScheduleListType(type);
                    beautyData.setScheduleList(scheduleList);

                    beautyData.setLastTimerEndTime(MusicRoomConfigMgr.getNowTimeNumberStartTime());
                    beautyData.setLiveInTime(DateHelper.getCurrentTime());
                    beautyData.setNowBuildingId(beautyData.getLiveInBuildId());
                }
            }else {
                UserMusicRoomBeautyData beautyData = musicRoomModule.getBeautyDataMap().get(beautyId);
                if (beautyData == null) {
                    helper.setResult(String.format("美女不存在"));
                    return;
                }
                if (beautyData.getLiveInBuildId() == 0) {
                    helper.setResult(String.format("美女未入住"));
                    return;
                }

                beautyData.setScheduleListType(type);
                beautyData.setScheduleList(scheduleList);


                beautyData.setLastTimerEndTime(MusicRoomConfigMgr.getNowTimeNumberStartTime());
                beautyData.setLiveInTime(DateHelper.getCurrentTime());
                beautyData.setNowBuildingId(beautyData.getLiveInBuildId());
            }

            //清空所有建筑的入住美女
            for (UserMusicRoomBuildingData buildingData : musicRoomModule.getBuildingDataMap().values()) {
                buildingData.setNowCheckInBeautyIds(new HashSet<>());
                buildingData.setWaitCheckInBeautyIds(new HashSet<>());
            }

            for (UserMusicRoomBeautyData beautyData : musicRoomModule.getSortLivingBeautyList()) {//重新入住
                UserMusicRoomBuildingData nowBuildingData = musicRoomModule.getBuildingDataMap().get(beautyData.getNowBuildingId());
                nowBuildingData.addNowBeautyId(beautyData.getBeautyId());

                int nextScheduleType = beautyData.getSchedule(MusicRoomConfigMgr.getNowTimeNumber() + 1);
                UserMusicRoomBuildingData searchBuildingData = MusicRoomConfigMgr.searchBuildingByScheduleType(musicRoomModule.getBuildingDataSortList(nextScheduleType), nextScheduleType, true);
                if (searchBuildingData == null) {
                    searchBuildingData = musicRoomModule.getBuildingDataMap().get(beautyData.getLiveInBuildId());
                }
                if (searchBuildingData != null) {
                    searchBuildingData.addWaitCheckInBeautyId(beautyData.getBeautyId());
                    beautyData.setNextBuildingId(searchBuildingData.getBuildId());
                }
            }

            musicRoomModule.initCheckInBuildingBeauty();

            String content = String.format("指定美女=%d,%s,行程列表=%s",
                    beautyId, type > 0 ? "生活行程" : "工作行程", StringUtils.listToString(scheduleList, ","));
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

            helper.setResult(String.format("指定美女行程成功",
                    beautyId));
            return;
        }

        if (command.equals("/mrunlockbuilding")) {//解锁建筑,并把家具升到指定等级
            List<Integer> list = StringUtils.stringToIntegerList(param, ",");
            Integer buildingId = list.get(0);
            Integer level = list.get(1);
            UserMusicRoomBuildingData buildingData = musicRoomModule.getBuildingDataMap().get(buildingId);
            if (buildingData == null) {
                int ret = musicRoomModule.unlockBuilding(buildingId);
                if (ret != 0) {
                    helper.setResult(String.format("解锁建筑失败,ret=%d", ret));
                    return;
                }
                buildingData = musicRoomModule.getBuildingDataMap().get(buildingId);
            }
            for (MusicRoomFurnitureInfo furnitureInfo : buildingData.getFurnitureInfos()) {
                furnitureInfo.setLevel(level);
            }
            buildingData.setUpdateOption();
            //计算繁荣度
            musicRoomModule.buildingAttrChange();

            helper.setResult(String.format("解锁建筑,并把家具升到指定等级%d", level));
            return;
        }

        if (command.equals("/mrbeautyup")) {//指定美女把升级道具用到完
            int beautyId = Integer.valueOf(param);
            UserMusicRoomBeautyData beautyData = musicRoomModule.getBeautyData(beautyId);
            if (beautyData == null) {
                helper.setResult(String.format("美女不存在"));
                return;
            }
            String content = String.format("指定美女=%d,升级前属性=%s",
                    beautyId, beautyData.getAttrPrintfStr());
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

            musicRoomModule.beautyUpgrade(beautyId, 2000, false);

            content = String.format("指定美女=%d,升级后属性=%s",
                    beautyId, beautyData.getAttrPrintfStr());
            msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

            helper.setResult("指定美女消耗所有升级道具");
            return;
        }

        if (command.equals("/mrfurnitureup")) {//把能升的家具都升了
            for (int i = 0; i < 10000; i++) {
                int ret = 0;
                for (UserMusicRoomBuildingData buildingData : musicRoomModule.getBuildingDataMap().values()) {
                    for (MusicRoomFurnitureInfo furnitureInfo : buildingData.getFurnitureInfos()) {
                        ret = musicRoomModule.furnitureUpgrade(buildingData.getBuildId(), furnitureInfo.getId(), 1);
                        if (ret > 0) {
                            break;
                        } else {
                            String content = String.format("建筑=%d,家具=%d,升级后等级=%d",
                                    buildingData.getBuildId(), MusicRoomConfigMgr.getFurnitureKindId(MusicRoomConfigMgr.getBuildType(buildingData.getBuildId()), furnitureInfo.getId()), furnitureInfo.getLevel());
                            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
                            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
                        }
                    }
                    if (ret > 0) {
                        break;
                    }
                }
                if (ret > 0) {
                    break;
                }
            }

            helper.setResult("消耗所有应援币升级家具");
            return;
        }

        if (command.equals("/mrdayre")) {
            musicRoomModule.refreshAppraiseList();
            helper.setResult("妙音坊刷新评价列表");
            return;
        }

        if (command.equals("/mrreplace")) {
            musicRoomModule.replaceAppraiseList();
            helper.setResult("妙音坊替换评价");
            return;
        }

    }


    /**
     * 跨服指令转发
     */
    private static void cross(GamePlayer player, CommandHelper helper) throws Exception {
        String command = helper.getCommand();
        String param = helper.getParam();
        // 矿场
        if (command.startsWith("/ks")) {
            int matchGroupId = KuangMgr.getMatchGroupId();
            if (matchGroupId == -1) {
                throw new Exception("矿山争夺战分组找不到");
            }
            Kuang.CrossKuangTestCodeReqMsg.Builder builder = Kuang.CrossKuangTestCodeReqMsg.newBuilder();
            builder.setGroupId(matchGroupId);
            builder.setCode(command);
            builder.setParam(param);
            player.getModule(KuangModule.class).sendAppointActivityPacket(Protocol.C_CROSS_KUANG_TEST_CODE, builder);
            helper.setResult("【矿山争夺战】success!!!");
        }
        // 山河乐宴
        if (command.startsWith("/shh")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.Feast.getValue());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有山河乐宴活动");
            }
            ShanHeFeastProto.CrossFeastTestCodeReqMsg.Builder builder = ShanHeFeastProto.CrossFeastTestCodeReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(command);
            player.sendPacket(Protocol.C_CROSS_SHAN_HE_FEAST_TEST_CODE, builder);
            helper.setResult("【山河乐宴】success!!!");
        }
        // 行游山水
        if (command.startsWith("/shanshui")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.XingYouShanShui.getValue());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有行游山水活动");
            }
            ShanHeFeastProto.CrossFeastTestCodeReqMsg.Builder builder = ShanHeFeastProto.CrossFeastTestCodeReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(command + " " + param);
            player.sendUnionActivityGroupPacket(Protocol.C_XING_YOU_SHAN_SHUI_EST_CODE, builder, builder.getActivityId());
            helper.setResult("【行游山水】success!!!");
        }
        // 厨神对决
        if (command.startsWith("/chef2")) {
            List<ActivityInfo> openActivityInfoList = ChefDuelActivityMgr.getOpenActivityInfoList(eActivityType.ChefDuel.getValue(), eChefDuelActivityType.Phase2.getChildType());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有厨神对决2活动");
            }
            ShanHeFeastProto.CrossFeastTestCodeReqMsg.Builder builder = ShanHeFeastProto.CrossFeastTestCodeReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(command + " " + param);
            player.sendPacket(Protocol.C_CROSS_CHEF_DUEL_TEST_CODE, builder);
            helper.setResult("【厨神对决2】success!!!");
        }
        if (command.startsWith("/chef3")) {
            List<ActivityInfo> openActivityInfoList = ChefDuelActivityMgr.getOpenActivityInfoList(eActivityType.ChefDuel.getValue(), eChefDuelActivityType.Phase3.getChildType());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有厨神对决3活动");
            }
            ShanHeFeastProto.CrossFeastTestCodeReqMsg.Builder builder = ShanHeFeastProto.CrossFeastTestCodeReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(command + " " + param);
            player.sendPacket(Protocol.C_CROSS_CHEF_DUEL_TEST_CODE, builder);
            helper.setResult("【厨神对决3】success!!!");
        }
        // 盗墓
        if (command.startsWith("/dm")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.DaoMu.getValue());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有盗墓活动");
            }
            // 转发gm上跨服
            DaoMuPvpProto.DaoMuPvpDebugReqMsg.Builder builder = DaoMuPvpProto.DaoMuPvpDebugReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
            player.sendPacket(Protocol.C_CROSS_DAOMU_PVP_DEBUG, builder);
            helper.setResult("【盗墓笔记】gm指令执行成功!!!");
        }
        // 隋唐
        if (command.startsWith("/st")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.SuiTang.getValue());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有隋唐活动");
            }
            // 转发gm上跨服
            SuiTang.CrossSuiTangDebugReqMsg.Builder builder = SuiTang.CrossSuiTangDebugReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
            player.sendUnionActivityGroupPacket(Protocol.C2_SUI_TANG_DEBUG, builder, builder.getActivityId());
            helper.setResult("【逐鹿隋唐】gm指令执行成功!!!");
        }
        // 九州
        if (command.startsWith("/jz")) {
            JiuZhouConfig config = JiuZhouMgr.getConfig();
            if (config == null || !ActivityHelper.activityInShowTime(config.getActivityInfo())) {
                throw new Exception("暂无九州棋局活动");
            }
            if (command.equals("/jzjump")) {
                JiuZhouMgr.jumpTest(param);
            }

            // 转发gm上跨服
            CrossJiuZhouProto.JiuZhouDebugReqMsg.Builder builder = CrossJiuZhouProto.JiuZhouDebugReqMsg.newBuilder();
            builder.setActivityId(config.getActivityInfo().getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
            player.sendPacket(Protocol.C_CROSS_JIU_ZHOU_DEBUG_CODE, builder);
            helper.setResult("【九州棋局】指令执行成功!!!");

            // 重新计算下门客
            PatronsModule patronsModule = player.getModule(PatronsModule.class);
            List<UserPatrons> userPatronsList = patronsModule.getUserPatronsList();
            patronsModule.onPatronsListChange(userPatronsList);
        }
        if (command.startsWith("/zh3")) {
            ZhenHuanThirdProcessConfig config = ZhenHuanConfigMgr.getThirdProcessConfig();
            if (config == null || !ActivityHelper.activityInShowTime(config.getActivityInfo())) {
                throw new Exception("暂无甄嬛第三阶段活动");
            }

            if (command.equals("/zh3-init")) {//往晋升名单里添加一下
                ZhenHuanSecondProcessConfig secondProcessConfig = ZhenHuanConfigMgr.getSecondProcessConfig();
                if (secondProcessConfig != null) {
                    GameZhenHuanPromotionData promotionData = ZhenHuanMgr.getPromotionData(secondProcessConfig.getActivityId());
                    Map<Long, ZhenHuanPromotionInfo> promotionInfoMap = promotionData.getPromotionInfoMap();
                    if (!promotionInfoMap.containsKey(player.getUserId())) {
                        ZhenHuanPromotionInfo zhenHuanPromotionInfo = new ZhenHuanPromotionInfo();
                        zhenHuanPromotionInfo.setUserId(player.getUserId());
                        zhenHuanPromotionInfo.setRank(1);
                        zhenHuanPromotionInfo.setParam("1");
                        zhenHuanPromotionInfo.setValue(BigInteger.ONE);
                        promotionInfoMap.put(player.getUserId(), zhenHuanPromotionInfo);
                        promotionData.setUpdateOption();
                    }
                    List<ZhenHuanProto.ZhenHuanPromotionTemp> zhenHuanPromotionTemps = ZhenHuanPb.parsePromotionTempList(new ArrayList<>(promotionInfoMap.values()));
                    ZhenHuanMgr.setPromotion(secondProcessConfig.getActivityId(), zhenHuanPromotionTemps);
                }
            } else {
                // 转发上跨服
                ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.Builder builder = ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.newBuilder();
                builder.setActivityId(config.getActivityId());
                builder.setCode(helper.getCommand());
                builder.setParam(helper.getParam());
                player.sendPacket(Protocol.C_CROSS_ZHENHUAN_THIRD_PROCESS_DEBUG_CODE, builder);
            }


            helper.setResult("【甄嬛三阶段】指令执行成功!!!");
        }
        if (command.startsWith("/sonHai")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.SonHai.getValue());
            if (openActivityInfoList.isEmpty()) {
                throw new Exception("没有【山海伏兽】活动");
            }
            // 转发gm上跨服
            SonHaiProto.SonHaiDebugReqMsg.Builder builder = SonHaiProto.SonHaiDebugReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
//            player.sendPacket(Protocol.C2_SON_HAI_DEBUG, builder);
            player.sendUnionActivityGroupPacket(Protocol.C2_SON_HAI_DEBUG, builder, builder.getActivityId());
            helper.setResult("【山海伏兽】gm指令执行成功!!!");
        }
        if (command.startsWith("/hsd")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.HsIsland.getValue());
            if (openActivityInfoList.isEmpty()) {
                throw new Exception("没有【海神岛】活动");
            }
            // 转发gm上跨服
            HsIslandProto.HsIslandDebugReqMsg.Builder builder = HsIslandProto.HsIslandDebugReqMsg.newBuilder();
            builder.setActivityId(openActivityInfoList.get(0).getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
            player.sendUnionActivityGroupPacket(Protocol.C2_HS_ISLAND_DEBUG_CODE, builder, builder.getActivityId());
            helper.setResult("【海神岛】执行GM指令");
        }
        if (command.startsWith("/cwjCountVipPower")) {
            SonHaiActivityMgr.test();
            // 转发gm上跨服
            helper.setResult("【山海伏兽】gm指令执行成功!!!");
        }
        if (command.startsWith("/cwjCountVipPower")) {
            SonHaiActivityMgr.test();
            // 转发gm上跨服
            helper.setResult("【山海伏兽】gm指令执行成功!!!");
        }
        if (command.startsWith("/appr")) {
            if (helper.getCommand().equalsIgnoreCase("/appr-test")) {
                ApprenticeMgr.test(Integer.parseInt(param));
                helper.setResult("【爱徒养成数值测试】gm指令执行成功!!!");
            } else {
                List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.Apprentice.getValue());
                if (openActivityInfoList.isEmpty()) {
                    throw new Exception("没有【爱徒养成】活动");
                }
                // 转发gm上跨服
                ApprenticeProto.ApprenticeDebugReqMsg.Builder builder = ApprenticeProto.ApprenticeDebugReqMsg.newBuilder();
                builder.setActivityId(openActivityInfoList.get(0).getActivityId());
                builder.setCode(helper.getCommand());
                builder.setParam(helper.getParam());
                player.sendPacket(Protocol.C2_APPRENTICE_DEBUG, builder);
                helper.setResult("【爱徒养成】gm指令执行成功!!!");
            }
        }

        if (command.startsWith("/chzb")) {//楚汉争霸
            ChuHanConfig config = ChuHanMgr.getConfig();
            if (config == null) {
                helper.setResult("没有开启楚汉争霸活动");
                return;
            }

            if (command.equals("/chzballuser")) {
                Map<Integer, UnionActivityGroup> groupMap = GameUnionActivityGroupMgr.getGroupMap(config.getActivityInfo().getActivityId());
                for (UnionActivityGroup group : groupMap.values()) {
                    ConcurrentHashMap<String, UnionActivityGroupUnion> unionDataMap = group.getUnionDataMap();
                    for (UnionActivityGroupUnion union : unionDataMap.values()) {
                        for (Long memberId : union.getUserMap().keySet()) {
                            GamePlayer memberPlayer = GamePlayerMgr.getPlayer(memberId);
                            if (memberPlayer != null) {
                                memberPlayer.getModule(ChuHanModule.class).crossLogin();
                                if (memberPlayer.getState() != PlayerState.ONLINE) {
                                    GamePlayerMgr.onLogout(memberPlayer, true);
                                }
                            }
                        }
                    }
                }

                helper.setResult("把所有有资格的玩家数据上传到跨服产生队伍数据");
                return;
            }

            // 转发上跨服
            ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.Builder builder = ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.newBuilder();
            builder.setActivityId(config.getActivityInfo().getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
            player.sendUnionActivityGroupPacket(Protocol.C2_CHUHAN_DEBUG, builder, config.getActivityInfo().getActivityId());
            helper.setResult("【楚汉争霸】gm指令发到跨服了!!!");
        }
    }

    private static void daomu(GamePlayer player, CommandHelper helper) throws Exception {
        if (helper.isFinish()) {
            return;
        }
        String command = helper.getCommand();
        if (command.equals("/cpf")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.DaoMu.getValue());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有盗墓活动");
            }
            // 藏品分
            int activityId = openActivityInfoList.get(0).getActivityId();
            DaoMuActivityUser activityUser = player.getModule(DaoMuActivityModule.class).getDaoMuActivityUser(activityId);
            DaoMuActivityConfig activityConfig = DaoMuActivityMgr.getActivityConfig(activityId);
            List<Integer> configList = new ArrayList<>();
            for (DaoMuCurioConfig curioConfig : activityConfig.getDaoMuCurioConfigMap().values()) {
                if (curioConfig.getType() == DaoMuCurioTypeEnum.TYPE_COLLECTION.getType() && !configList.contains(curioConfig.getId()) && curioConfig.getLevel() == 1) {
                    configList.add(curioConfig.getId());
                }
            }
            long start = System.currentTimeMillis();
            while (activityUser.countCollectionScore() < Long.parseLong(helper.getParam())) {
                if (System.currentTimeMillis() - start > 20 * DateHelper.SECOND_MILLIONS) {
                    player.getModule(DaoMuActivityModule.class).syncPlayerInfo();
                    throw new Exception("执行时间过长，降低一下藏品分,当前藏品分:" + activityUser.getCollectionScore());
                }
                Integer id = configList.get(randomHelper.next(0, configList.size()));
                activityUser.addProp(new Property(id, 1));
                // 批量升级
                activityUser.collectionUpgrade(activityConfig.getDaoMuCurioConfigMap().get(id).getCurioId(), false);
            }
            player.getModule(DaoMuActivityModule.class).syncPlayerInfo();
            helper.setResult("【盗墓笔记】随机增加藏品成功!,当前藏品分:" + activityUser.getCollectionScore());
        }
        if (command.startsWith("/pveDm")) {
            List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.DaoMu.getValue());
            if (openActivityInfoList.size() == 0) {
                throw new Exception("没有盗墓活动");
            }
            int activityId = openActivityInfoList.get(0).getActivityId();
            DaoMuActivityUser daoMuActivityUser = player.getModule(DaoMuActivityModule.class).getDaoMuActivityUser(activityId);
            daoMuActivityUser.debug(helper.getCommand(), helper.getParam());
            helper.setResult("【盗墓笔记】gm指令执行成功!!!");
        }
    }

    /*
     * 活动通用指令
     */
    private static void activity(GamePlayer player, CommandHelper helper) throws Exception {
        String command = helper.getCommand();
        String param = helper.getParam();
        if (command.startsWith("/act")) {
            List<String> list = StringUtils.stringToStringList(param, ",");
            if (list.isEmpty()) {
                helper.setResult("【活动通用指令】指令执行失败");
                return;
            }
            // param 是 1 方法名，后面可跟参数，逗号分隔
            // 只能调用基础类型参数的函数(只能调用 module.activity 中的函数)
            // 调用示例：/act harps.HarpsModule,harpsDebug,3
            // 需要自行编写类似 harpsDebug 的函数
            try {
                String className = list.get(0);
                String prefix = "com.yanqu.road.server.gameplayer.module.activity.";
                Class<?> aClass = Class.forName(prefix + className);
                Method method = null;
                String ret = "";
                if (list.size() > 2) {
                    method = aClass.getMethod(list.get(1), List.class);
                    method.setAccessible(true);
                    list.remove(0);
                    list.remove(0);
                    ret = (String) method.invoke(player.getModule(aClass), StringUtils.stringToIntegerList(StringUtils.listToString(list, ","), ","));
                } else {
                    method = aClass.getDeclaredMethod(list.get(1));
                    method.setAccessible(true);
                    list.remove(0);
                    list.remove(0);
                    method.invoke(player.getModule(aClass));
                }
                if (ret != null && !ret.isEmpty()) {
                    helper.setResult(ret);
                } else {
                    helper.setResult("【活动通用指令】指令执行成功");
                }
            } catch (Exception e) {
                helper.setResult("【活动通用指令】指令执行失败，没有找到指令");
            }
        }
    }

    /**
     * 常用的
     */
    private static void common(GamePlayer player, CommandHelper helper) throws Exception {
        if (helper.isFinish()) {
            return;
        }
        String command = helper.getCommand();
        String param = helper.getParam();
        if (command.equals("/test")) {
            RoadProto.RoadBattleReqMsg.Builder builder = RoadProto.RoadBattleReqMsg.newBuilder();
            builder.setIsEventSelect(false);
            for (int i = 0; i < 1000; i++) {
                player.sendPacket(GameProtocol.S_PASS_ROAD_BATTLE, builder);
            }
            helper.setResult("repairClickHouse");
            return;
        }
        if (command.equals("/load1")) {
            // 等级#数量
            String[] split = param.split("#");
            ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 4, new GeneralThreadFactory("loadUser"));
            Map<Long, UserInfo> userInfoMap = UserBussiness.getUserInfoMapWithTitleId(Integer.parseInt(split[0]));
            AtomicInteger loadCnt = new AtomicInteger();
            for (UserInfo userInfo : userInfoMap.values()) {
                if (loadCnt.get() >= Integer.parseInt(split[1])) {
                    break;
                }
                threadPool.submit(() -> {
                    GamePlayer gamePlayer = GamePlayerMgr.getPlayer(userInfo.getUserId());

                    if (gamePlayer != null) {
                        // 海神岛报名
                        try {
                            gamePlayer.getModule(HsIslandActivityModule.class).enterActivity(HsIslandProto.HsIslandEnterActivityReqMsg.newBuilder().setActivityId(10039113).build());
                        } catch (BusinessException e) {
                            throw new RuntimeException(e);
                        }
                    }
                });
                loadCnt.getAndIncrement();
            }

            threadPool.shutdown();
            helper.setResult("【加载用户】 加载等级:" + split[0] + "以上的用户,加载数量:" + loadCnt.get());
        }
        if (command.equals("/loadUser")) {
            ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 4, new GeneralThreadFactory("loadUser"));
            String[] split = param.split("#");
            String openIdPre = split[0];
            int openIdStart = Integer.parseInt(split[1]);
            int openIdEnd = Integer.parseInt(split[2]);
            for (int index = openIdStart; index <= openIdEnd ; index++) {
                String openId = String.format("%s%d", openIdPre, index);
                List<UserInfo> userInfoList = UserBussiness.getUserInfoList(openId);
                if (userInfoList.isEmpty()) {
                    continue;
                }
                threadPool.submit(() -> {
                    GamePlayer gamePlayer = GamePlayerMgr.getPlayer(userInfoList.get(0).getUserId());

                    if (gamePlayer != null) {
                        // 海神岛报名
                        try {
                            gamePlayer.getModule(HsIslandActivityModule.class).enterActivity(HsIslandProto.HsIslandEnterActivityReqMsg.newBuilder().setActivityId(10039113).build());
                        } catch (BusinessException e) {
                            throw new RuntimeException(e);
                        }
                    }
                });
            }

            threadPool.shutdown();
            helper.setResult("【加载用户】 加载成功");
        }
        if (command.equals("/online")) {
            int onlineCount = GamePlayerMgr.getAllOnlinePlayer().size();
            int playerCount = GamePlayerMgr.getPlayerMap().size();
            helper.setResult("【在线用户】 内存用户数:" + playerCount + "在线用户数:" + onlineCount);
        }
        if (command.equals("/kick")) {
            GamePlayerMgr.onLogout(player,true);
            helper.setResult("【踢出】执行成功");
        }
        if (command.equals("/init")) {
            // 初始化一个高级账号
            initUser(player);
            helper.setResult("【系统】初始化高级用户数据成功");
        }
        // 模拟无参请求
        if (command.equals("/req")) {
            player.sendPacket(YanQuMessageUtils.buildMessage(Integer.parseInt(param)));
            helper.setResult("【系统】模拟无参请求,协议号:" + param);
        }
        if (command.equals("/sendmail")) {
            MailManager.sendMail(player.getUserId(), eMailType.SYSTEM.getValue(), param, "邮件发放", "邮件发放");
            helper.setResult("【系统】发送邮件成功,附件:" + param);
        }
        if (command.equals("/use")) {
            Property property = PropertyHelper.parseStringToProperty(param);
            for (Map.Entry<Integer, BigInteger> entry : property.getGoods().entrySet()) {
                GoodsInfo goodsInfo = GoodsMgr.getGoodsById(entry.getKey());
                if(goodsInfo == null){
                    throw new Exception("物品不存在");
                }
                BaseUseGoods useGoodsEntity = BaseUseGoods.getUseGoodsEntity(player, goodsInfo, 0, "");
                if(useGoodsEntity == null){
                    throw new Exception("物品不存在");
                }
                UseGoodsResult result = useGoodsEntity.useGoods(entry.getValue().longValue());
                if (result.getRet() != 0) {
                    throw new Exception("【道具】使用道具失败,错误码:" + result.getRet());
                }
            }
            helper.setResult("【道具】使用道具成功:" + param);
        }
        if (command.equals("/useSkin")) {
            Property property = PropertyHelper.parseStringToProperty(param);
            for (Map.Entry<Integer, BigInteger> entry : property.getGoods().entrySet()) {
                GoodsInfo goodsInfo = GoodsMgr.getGoodsById(entry.getKey());
                if(goodsInfo == null){
                    throw new Exception("皮肤不存在");
                }
                BaseUseGoods useGoodsEntity = BaseUseGoods.getUseGoodsEntity(player, goodsInfo, 0, "");
                if(useGoodsEntity == null){
                    throw new Exception("皮肤不存在");
                }
                long cnt = entry.getValue().longValue();
                while (cnt-- > 0) {
                    UseGoodsResult result = useGoodsEntity.useGoods(1);
                    if (result.getRet() != 0) {
                        break;
                    }
                }
            }
            helper.setResult("【道具】使用皮肤成功" + param);
        }
        // 发道具
        CurrencyModule currencyModule = player.getModule(CurrencyModule.class);
        if (command.equals("/add")) {
            Property property = PropertyHelper.parseStringToProperty(param);
//            for (int goodsId : property.getGoods().keySet()) {
//                if (GoodsMgr.getGoodsById(goodsId) == null) {
//                    throw new Exception("道具id:" + goodsId + "不存在");
//                }
//            }
            currencyModule.addCurrency(property, eLogMoneyType.GM, eLogMoneyType.GM);
            StringBuilder sb = new StringBuilder();
            for (Map.Entry<Integer, BigInteger> entry : property.getGoods().entrySet()) {
                GoodsInfo goodsInfo = GoodsMgr.getGoodsById(entry.getKey());
                if (goodsInfo != null) {
                    String goodsName = MultipleLanguageMgr.getContent(GoodsMgr.getGoodsById(entry.getKey()).getGoodsName(), player.getLanguage());
                    sb.append(entry.getValue()).append("个").append(goodsName).append(";");
                } else {
                    sb.append(entry.getValue()).append("个").append(entry.getKey()).append(";");
                }
            }
            helper.setResult("【道具】增加道具成功,道具:" + sb);
        }
        // 扣道具
        if (command.equals("/del")) {
            Property property = PropertyHelper.parseStringToProperty(param);
            if (!currencyModule.currencyIsEnough(property)) {
                helper.setResult("【道具】扣除道具失败,道具不足");
            }
            currencyModule.removeCurrency(property, eLogMoneyType.GM, eLogMoneyType.GM);
            StringBuilder sb = new StringBuilder();
            for (Map.Entry<Integer, BigInteger> entry : property.getGoods().entrySet()) {
                String goodsName = MultipleLanguageMgr.getContent(GoodsMgr.getGoodsById(entry.getKey()).getGoodsName(), player.getLanguage());
                sb.append(entry.getValue()).append("个").append(goodsName).append(";");
            }
            helper.setResult("【道具】扣除道具成功,道具:" + sb);
        }
        // 修改等级
        if (command.equals("/xgdj")) {
            PlayerModule playerModule = player.getModule(PlayerModule.class);
            player.getModule(PlayerModule.class).getUserInfo().setTitleId(Integer.parseInt(param));
            //身份变更
            playerModule.onTitleChange();
            playerModule.onUserInfoChange();
            helper.setResult("【角色】修改等级成功,当前等级:" + param);
        }
        // 发门客
        if (command.equals("/tjsymk")) {
            PatronsModule patronsModule = player.getModule(PatronsModule.class);
            for (PatronsInfo patronsInfo : PatronsMgr.getPatronsInfoMap().values()) {
                UserPatrons userPatrons = patronsModule.getUserPatrons(patronsInfo.getId());
                if (userPatrons != null) {
                    continue;
                }
                patronsModule.addPatrons(patronsInfo.getId(), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            patronsModule.syncPatronsDataAll(false);
            helper.setResult("【门客】获得所有门客成功");
        }
        // 升级所有门客
        PatronsModule patronsModule = player.getModule(PatronsModule.class);
        if (command.equals("/sjsymk")) {
            for (UserPatrons userPatrons : patronsModule.getUserPatronsList()) {
                userPatrons.setBreakLv(PatronsMgr.getPatronsMaxBreakLv());
                int embroideryMeter = player.getModule(SkinVolumeModule.class).getSkinVolumeData().getEmbroideryMeter();
                int curMaxLv = PatronsMgr.getCurMaxLevel(userPatrons.getBreakLv(), userPatrons.getPatronsId(), embroideryMeter);
                userPatrons.setLevel(curMaxLv);
            }
            patronsModule.syncPatronsDataAll(false);
            helper.setResult("【门客】升级所有门客成功");
        }
        // 发美女
        BeautyModule beautyModule = player.getModule(BeautyModule.class);
        if (command.equals("/tjsymn")) {
            for (BeautyInfo beautyInfo : BeautyMgr.getBeautyInfoMap().values()) {
                UserBeauty userBeauty = beautyModule.getUserBeauty(beautyInfo.getBeautyId());
                if (userBeauty != null) {
                    continue;
                }
                beautyModule.addBeauty(beautyInfo.getBeautyId(), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            helper.setResult("【美女】获得所有美女成功");
        }
        // 庄园繁荣度
        if (command.equals("/zyfrd")) {
            ManorModule manorModule = player.getModule(ManorModule.class);
            long count = Long.parseLong(param);
            manorModule.addProsperousValue(count, "gm");
            manorModule.syncManorData();
            helper.setResult("【庄园】修改繁荣度成功，当前繁荣度" + manorModule.getUserManorData().getProsperousValue());
        }
        // 解锁所有商铺
        if (command.equals("/jssysp")) {
            Map<Integer, BuildingInfo> buildingInfoMap = BuildingBussiness.getBuildingInfoMap();
            BuildingModule buildingModule = player.getModule(BuildingModule.class);
            for (int buildId : buildingInfoMap.keySet()) {
                buildingModule.addBuilding(buildId);
            }
            helper.setResult("【商铺】解锁所有商铺成功");
        }
        // 修改府邸
        if (command.equals("/xgfd")) {
            String[] split = param.split(",");
            UserEstateWarData userEstateWarData = player.getModule(EstateWarModule.class).getUserEstateWarData();
            // 府邸类别
            userEstateWarData.setType(Integer.parseInt(split[0]));
            // 地产楼层位置
            userEstateWarData.setPos(Integer.parseInt(split[1]));
            int estateSkinId = ConfigMgr.getEstateSkinId(userEstateWarData.getType());
            userEstateWarData.setEstateSkinId(estateSkinId);
            player.getModule(EstateWarModule.class).syncUserEstateWarData();
            helper.setResult("【府邸】修改府邸成功");
        }
        // 添加所有珍兽
        if (command.equals("/tjsyzs")) {
            VehicleModule vehicleModule = player.getModule(VehicleModule.class);
            for (Integer vehicleId : VehicleMgr.getVehicleInfoMap().keySet()) {
                vehicleModule.addVehicle(vehicleId, 1, eLogMoneyType.GM, eLogMoneyType.GM);
            }
            helper.setResult("【珍兽】添加所有珍兽成功");
        }
        // 添加所有鱼类
        if (command.equals("/tjsyyl")) {
            ManorModule manorModule = player.getModule(ManorModule.class);
            for (FishPondItemConfig fishPondItemConfig : FishPondMgr.getFishPondItemConfigMap().values()) {
                if (fishPondItemConfig.getType() != 1) {
                    continue;
                }
                int randomFishWeight = FishPondMgr.randomFishWeight(fishPondItemConfig);
                manorModule.getManorFishPondModel().addFish(fishPondItemConfig, randomFishWeight, false);
            }
            manorModule.getManorFishPondModel().init();
            helper.setResult("【珍兽】添加所有鱼类成功");
        }
        // 修改关卡
        if (command.equals("/xggq")) {
            PassRoadModule passRoadModule = player.getModule(PassRoadModule.class);
            passRoadModule.getUserPassRoad().setPassId(Integer.parseInt(param));
            passRoadModule.initPassRoadSystem();
            helper.setResult("【关卡】修改关卡成功，当前关卡:" + passRoadModule.getUserPassId());
        }
        if (command.equals("/xgncj")) {
            player.getModule(SkinVolumeModule.class).getSkinVolumeData().setEmbroideryMeter(Integer.parseInt(param));
            helper.setResult("【系统】修改霓裳卷成功");
        }
        if (command.equals("/yjjjmk")) {
            for (UserPatrons userPatrons : patronsModule.getUserPatronsList()) {
                patronsModule.patronsStage(userPatrons.getPatronsId());
            }
            helper.setResult("【门客】一键精进门客成功");
        }
        if (command.equals("/jnyjmj")) {
            for (UserPatrons userPatrons : patronsModule.getUserPatronsList()) {
                for (UserPatronsSkill userPatronsSkill : userPatrons.getSkillList()) {
                    SkillInfo skillInfo = SkillMgr.getSkillInfo(userPatronsSkill.getSkillId());
                    userPatronsSkill.setSkillLv(patronsModule.getMaxLevel(userPatronsSkill, skillInfo, skillInfo.getType(), userPatrons.getPatronsId()));
                }
            }
            patronsModule.syncPatronsDataAll(false);
            helper.setResult("【门客】技能一键升级成功");
        }
        if (command.equals("/beautyGlamour")) {
            for (Integer beautyId : beautyModule.getBeautyMap().keySet()) {
                UserBeauty userBeauty = beautyModule.getUserBeauty(beautyId);
                beautyModule.addGlamour(userBeauty, randomHelper.next(1000000, 10000000), eLogMoneyType.System.getValue(), eLogMoneyType.System.getValue());
            }
            helper.setResult("【美女】一键增加魅力值");
        }
        if (command.equals("/beautyIntimacy")) {
            for (Integer beautyId : beautyModule.getBeautyMap().keySet()) {
                UserBeauty userBeauty = beautyModule.getUserBeauty(beautyId);
                beautyModule.addIntimacy(userBeauty, randomHelper.next(1000000, 10000000), eLogMoneyType.System.getValue(), eLogMoneyType.System.getValue());
            }
            helper.setResult("【美女】一键增加亲密度");
        }
        if (command.equals("/beautySkill")) {
            for (Integer beautyId : beautyModule.getBeautyMap().keySet()) {
                UserBeauty userBeauty = beautyModule.getUserBeauty(beautyId);
                for (UserBeautySkill beautySkill : userBeauty.getSkillMap().values()) {
                    beautySkill.setSkillValue(30);
                }
            }
            helper.setResult("【美女】一键升级技能");
        }
        if (command.equals("/beautyPromotion")) {
            for (Integer beautyId : beautyModule.getBeautyMap().keySet()) {
                beautyModule.beautyPromotion(beautyId);
            }
            helper.setResult("【美女】一键晋升");
        }
        if (command.equals("/beautyDelSelectPatronsCd")) {
            int beautyId = Integer.parseInt(param);
            UserBeauty userBeauty = beautyModule.getUserBeauty(beautyId);
            if (userBeauty == null) {
                helper.setResult(beautyId + "【美女】不存在");
                return;
            }
            for (BeautySelfSelectPatronsPosition info : userBeauty.getSelfSelectPatronsMap().values()) {
                info.setCd(0);
            }
            for (BeautyPeerlessSkillInfo info : userBeauty.getPeerlessSkillMap().values()) {
                info.setCd(0);
            }
            beautyModule.syncUserBeauty(userBeauty);
            helper.setResult("【美女】删除自选门客CD成功");
        }
        if (command.equals("/jinli")) {
            String[] split = param.split("#");  // 活动id#商品id

            player.getModule(JinLiModule.class).recharge(Integer.parseInt(split[0]), MallMgr.getMallInfoByMallId(Integer.parseInt(split[1])));
            helper.setResult("【锦鲤礼包】锦鲤礼包购买成功");
        }
        if (command.equals("/showpatrons")) {
            int patronsId = Integer.parseInt(param);
            UserPatrons userPatrons = player.getModule(PatronsModule.class).getUserPatrons(patronsId);
            if (userPatrons == null) {
                helper.setResult(patronsId + "【门客】门客不存在");
                return;
            }
            CalcPatronsAbilityParam calcPatronsAbilityParam = player.getModule(PatronsModule.class).buildCalcPatronsAbilityParam();
            PatronsMgr.printfPatronsAbilityToChat(player, userPatrons, calcPatronsAbilityParam);
            helper.setResult(patronsId + "【门客】门客信息已打印到聊天框");
        }
        if (command.equals("/openWingRoom")) {
            //解锁厢房，发点家具
            int systemId = eSystemId.WingRoom.getValue();
            BigInteger systemValue = BigInteger.valueOf(2).pow(systemId);
            BigInteger systemOpenValue = player.getUserInfo().getSystemOpenValue();
            if(systemValue.compareTo(systemOpenValue.and(systemValue)) != 0){
                systemOpenValue = systemOpenValue.add(systemValue);
                player.getUserInfo().setSystemOpenValue(systemOpenValue);
                player.getModule(CurrencyModule.class).addCurrency(SystemOpenMgr.getSystemOpenInfo(systemId).getReward(), eLogMoneyType.System,
                        eLogMoneyType.SystemOpen);
                player.getModule(WingRoomModule.class).initSystem();
                player.getModule(WingRoomChakraModule.class).initBaseData();
                player.getModule(WorkShopModule.class).initSystem();
                player.getModule(WingRoomMessageModule.class).initSystem();
                player.getModule(PlayerModule.class).syncSystemOpen();
            }
            for (WingRoomFurnitureConfig wingRoomFurnitureConfig : WingRoomConfigMgr.getFurnitureConfigMap().values()) {
                Property property = new Property(wingRoomFurnitureConfig.getFurnitureId(), BigInteger.valueOf(20));
                player.getModule(CurrencyModule.class).addCurrency(property, eLogMoneyType.GM, eLogMoneyType.GM);
            }
            helper.setResult("【厢房解锁】发送家具");
        }
        if (command.equals("/chakraCount")) {
            player.getModule(WingRoomChakraModule.class).reCountData();
            helper.setResult("【厢房命盘】重新计算风水数据");
        }
        if (command.equals("/chakraDelete")) {
            player.getModule(WingRoomChakraModule.class).getUserWingRoomChakraDetailMap().clear();
            player.getModule(WingRoomChakraModule.class).getUserWingRoomChakra().setChakraExp(0L);
            player.getModule(WingRoomChakraModule.class).getUserWingRoomChakra().setChakraLevel(1);
            player.getModule(WingRoomChakraModule.class).syncData();
            helper.setResult("【厢房命盘】重置命盘数据");
        }
        if (command.equals("/chakraBfPropCount")) {
            String str = "";
            String[] furnitureArr = str.split(";");
            //获取奖励配置，遍历奖励配置，发放奖励
            Property property = new Property();
            for (String furnitureStr : furnitureArr) {
                int furnitureId = Integer.parseInt(furnitureStr.split(",")[0]);
                int furnitureLevel = Integer.parseInt(furnitureStr.split(",")[1]);
                Map<Integer, String> rewardMap = WingRoomConfigMgr.getFurnitureUpgradeRewardMap(furnitureId);
                for (Map.Entry<Integer, String> entry : rewardMap.entrySet()) {
                    int level = entry.getKey();
                    String reward = entry.getValue();
                    //判断奖励是否已经领取过
                    if (furnitureLevel >= level) {
                        Property furnitureProp = PropertyHelper.parseStringToProperty(reward);
                        property.addProperty(furnitureProp);
                    } else {
                        break;
                    }
                }
            }
            BigInteger num = property.getGoods().get(110326) != null ? property.getGoods().get(110326) : BigInteger.ZERO;
            helper.setResult("【厢房命盘】计算风水符补发奖励：" + num.toString());
        }

        if (command.equals("/bind")) {
//            String encode = URLEncoder.encode("🤡", "UTF-8");
//            String decode = URLDecoder.decode(encode, "UTF-8");
            player.sendPacket(GameProtocol.S_WECHAT_BIND_ROLE_CANCEL_BIND, ConfigProto.WechatBindRoleInfoReqMsg.newBuilder());
            helper.setResult("【微信绑定】发送绑定请求");
        }
        if (command.equals("/countChakraWindWaterLimit")) {
            //基础风水值上限
            long baseLimit = GameConfig.CHAKRAS_INITIAL_GEOMANCY_MAXIMUMS;
            System.out.println("基础上限：" + baseLimit);
            String str = "200103,1;200107,2;200108,2;200109,2;200111,1;200112,4;200113,4;200114,1;200115,1;200116,1;200118,4;200202,3;200203,5;200204,7;200206,1;200207,1;200208,5;200209,4;200210,4;200211,2;200212,1;200213,3;200214,3;200215,4;200216,4;200217,3;200302,2;200305,1;200307,1;200311,3;200312,2;200316,2;200402,4;200403,4;200404,5;200406,1;200407,9;200408,4;200410,8;200411,5;200412,3;200413,3;200414,4;200415,6;200416,6;200417,5;200505,1;200508,5;200515,3;200516,2;200518,2;200604,1;200605,1;200606,3;200607,2;200609,2;200610,2;200611,4;200614,2;200617,5;200701,3;200702,3;200703,4;200704,3;200705,3;200706,3;200801,3;200802,3;200803,3;200804,3;200805,3;200806,4;200807,3;200808,4;200809,3;200810,3;200811,3;200812,3;200813,3;200814,3;200815,3;200816,3;200817,3;200818,3;200819,3;200820,3;200821,3;200822,3;200823,3;200824,4;200825,3;200826,2;200827,3;200828,1;200829,3;200830,3;200831,3;200832,3;200833,3;200834,3;200835,3;200836,2;200837,2;200838,3;200839,3;200840,3;200841,3;200842,3;200843,3;200844,3;200845,3;200846,3;200847,3;200848,3;200849,3;200850,3;200851,3;200852,3;200853,3;200854,3;200855,3;200856,3;200857,3;200858,3;201501,3;201502,6;201503,8;201504,2;201602,2;201604,1;201706,1;201714,1";
            String[] strArr = str.split(";");
            for (String item : strArr) {
                String[] itemArr = item.split(",");
                int id = Integer.parseInt(itemArr[0]);
                int level = Integer.parseInt(itemArr[1]);
                WingRoomFurnitureConfig furnitureConfig = WingRoomConfigMgr.getFurnitureConfig(id);
                //多少级加多少次
                int addValue = 0;
                for (int i = 0; i < level; i++) {
                    baseLimit += furnitureConfig.getIncreaseGeomancy();
                    addValue += furnitureConfig.getIncreaseGeomancy();
                }
                if (furnitureConfig.getIncreaseGeomancy() > 0) {
                    System.out.println("家具ID:" + id + ",等级:" + level + ",1级上限加成:" + furnitureConfig.getIncreaseGeomancy() + ",总加成:" + addValue);
                }
            }
            System.out.println("所有总上限：" + baseLimit);

            //计算风水值
            long baseWindWater = 0;
            //区域map
            String reStr = "{1:{\"furnitureList\":[{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200417,\"no\":-1,\"originBlock\":{\"x\":-1,\"y\":-1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200308,\"no\":18,\"originBlock\":{\"x\":23,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200304,\"no\":40,\"originBlock\":{\"x\":0,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201907,\"no\":39,\"originBlock\":{\"x\":13,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201903,\"no\":38,\"originBlock\":{\"x\":10,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201501,\"no\":36,\"originBlock\":{\"x\":7,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200404,\"no\":19,\"originBlock\":{\"x\":21,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200101,\"no\":1,\"originBlock\":{\"x\":6,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200828,\"no\":6,\"originBlock\":{\"x\":3,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200828,\"no\":5,\"originBlock\":{\"x\":0,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200207,\"no\":17,\"originBlock\":{\"x\":23,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200205,\"no\":16,\"originBlock\":{\"x\":23,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200204,\"no\":15,\"originBlock\":{\"x\":10,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200204,\"no\":13,\"originBlock\":{\"x\":7,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200204,\"no\":14,\"originBlock\":{\"x\":4,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201601,\"no\":12,\"originBlock\":{\"x\":1,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201504,\"no\":11,\"originBlock\":{\"x\":23,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200828,\"no\":10,\"originBlock\":{\"x\":19,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200828,\"no\":9,\"originBlock\":{\"x\":16,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200828,\"no\":8,\"originBlock\":{\"x\":13,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200828,\"no\":7,\"originBlock\":{\"x\":10,\"y\":18}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200401,\"no\":4,\"originBlock\":{\"x\":23,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200201,\"no\":3,\"originBlock\":{\"x\":22,\"y\":17}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200201,\"no\":2,\"originBlock\":{\"x\":1,\"y\":1}}],\"regionId\":1},2:{\"furnitureList\":[{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200118,\"no\":-1,\"originBlock\":{\"x\":-1,\"y\":-1}},{\"faceDirection\":-1,\"floor\":false,\"furnitureId\":201710,\"no\":37,\"originBlock\":{\"x\":1,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200820,\"no\":35,\"originBlock\":{\"x\":11,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200851,\"no\":34,\"originBlock\":{\"x\":6,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200851,\"no\":33,\"originBlock\":{\"x\":5,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200851,\"no\":32,\"originBlock\":{\"x\":4,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200851,\"no\":31,\"originBlock\":{\"x\":3,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200851,\"no\":30,\"originBlock\":{\"x\":2,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200851,\"no\":29,\"originBlock\":{\"x\":1,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200858,\"no\":28,\"originBlock\":{\"x\":7,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200858,\"no\":27,\"originBlock\":{\"x\":5,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200858,\"no\":26,\"originBlock\":{\"x\":5,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200858,\"no\":25,\"originBlock\":{\"x\":3,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200858,\"no\":24,\"originBlock\":{\"x\":3,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200858,\"no\":23,\"originBlock\":{\"x\":1,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200411,\"no\":22,\"originBlock\":{\"x\":8,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200411,\"no\":21,\"originBlock\":{\"x\":5,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200409,\"no\":20,\"originBlock\":{\"x\":1,\"y\":10}}],\"regionId\":2},3:{\"furnitureList\":[{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201712,\"no\":176,\"originBlock\":{\"x\":12,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200849,\"no\":175,\"originBlock\":{\"x\":13,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200849,\"no\":174,\"originBlock\":{\"x\":14,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200849,\"no\":173,\"originBlock\":{\"x\":15,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200849,\"no\":172,\"originBlock\":{\"x\":16,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200812,\"no\":171,\"originBlock\":{\"x\":17,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200812,\"no\":170,\"originBlock\":{\"x\":18,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200317,\"no\":-1,\"originBlock\":{\"x\":-1,\"y\":-1}}],\"regionId\":3},4:{\"furnitureList\":[{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200838,\"no\":169,\"originBlock\":{\"x\":18,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200838,\"no\":168,\"originBlock\":{\"x\":15,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200807,\"no\":167,\"originBlock\":{\"x\":18,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200805,\"no\":166,\"originBlock\":{\"x\":19,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200805,\"no\":165,\"originBlock\":{\"x\":18,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200805,\"no\":164,\"originBlock\":{\"x\":14,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200805,\"no\":163,\"originBlock\":{\"x\":9,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200805,\"no\":162,\"originBlock\":{\"x\":10,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200805,\"no\":161,\"originBlock\":{\"x\":11,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200410,\"no\":160,\"originBlock\":{\"x\":16,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200410,\"no\":159,\"originBlock\":{\"x\":18,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200410,\"no\":158,\"originBlock\":{\"x\":18,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200410,\"no\":157,\"originBlock\":{\"x\":17,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200410,\"no\":156,\"originBlock\":{\"x\":15,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":155,\"originBlock\":{\"x\":15,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":154,\"originBlock\":{\"x\":15,\"y\":13}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":153,\"originBlock\":{\"x\":9,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":152,\"originBlock\":{\"x\":12,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":151,\"originBlock\":{\"x\":13,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":150,\"originBlock\":{\"x\":12,\"y\":13}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":149,\"originBlock\":{\"x\":12,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":148,\"originBlock\":{\"x\":12,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":147,\"originBlock\":{\"x\":12,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":146,\"originBlock\":{\"x\":13,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":145,\"originBlock\":{\"x\":15,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":144,\"originBlock\":{\"x\":16,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":143,\"originBlock\":{\"x\":17,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200407,\"no\":142,\"originBlock\":{\"x\":16,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200316,\"no\":141,\"originBlock\":{\"x\":16,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200316,\"no\":140,\"originBlock\":{\"x\":15,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":139,\"originBlock\":{\"x\":14,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":138,\"originBlock\":{\"x\":14,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":137,\"originBlock\":{\"x\":15,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":136,\"originBlock\":{\"x\":15,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":135,\"originBlock\":{\"x\":6,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":134,\"originBlock\":{\"x\":10,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":133,\"originBlock\":{\"x\":9,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200312,\"no\":132,\"originBlock\":{\"x\":10,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200216,\"no\":131,\"originBlock\":{\"x\":10,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200216,\"no\":130,\"originBlock\":{\"x\":9,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200216,\"no\":129,\"originBlock\":{\"x\":3,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200216,\"no\":128,\"originBlock\":{\"x\":1,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200215,\"no\":127,\"originBlock\":{\"x\":0,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200215,\"no\":126,\"originBlock\":{\"x\":0,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200214,\"no\":125,\"originBlock\":{\"x\":1,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200214,\"no\":124,\"originBlock\":{\"x\":4,\"y\":15}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200210,\"no\":123,\"originBlock\":{\"x\":7,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200210,\"no\":122,\"originBlock\":{\"x\":8,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200210,\"no\":121,\"originBlock\":{\"x\":10,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200210,\"no\":120,\"originBlock\":{\"x\":9,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200415,\"no\":82,\"originBlock\":{\"x\":15,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200317,\"no\":-1,\"originBlock\":{\"x\":-1,\"y\":-1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200203,\"no\":119,\"originBlock\":{\"x\":12,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200203,\"no\":118,\"originBlock\":{\"x\":12,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200313,\"no\":77,\"originBlock\":{\"x\":10,\"y\":13}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200306,\"no\":74,\"originBlock\":{\"x\":12,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200850,\"no\":117,\"originBlock\":{\"x\":17,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200848,\"no\":116,\"originBlock\":{\"x\":15,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200818,\"no\":115,\"originBlock\":{\"x\":15,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200818,\"no\":114,\"originBlock\":{\"x\":13,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200818,\"no\":113,\"originBlock\":{\"x\":13,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200821,\"no\":112,\"originBlock\":{\"x\":11,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200821,\"no\":111,\"originBlock\":{\"x\":11,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200854,\"no\":110,\"originBlock\":{\"x\":10,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200832,\"no\":109,\"originBlock\":{\"x\":11,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200825,\"no\":108,\"originBlock\":{\"x\":11,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":107,\"originBlock\":{\"x\":4,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":106,\"originBlock\":{\"x\":5,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":105,\"originBlock\":{\"x\":6,\"y\":14}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":104,\"originBlock\":{\"x\":7,\"y\":13}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":103,\"originBlock\":{\"x\":7,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":102,\"originBlock\":{\"x\":7,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":101,\"originBlock\":{\"x\":8,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200611,\"no\":100,\"originBlock\":{\"x\":9,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200606,\"no\":99,\"originBlock\":{\"x\":9,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200606,\"no\":98,\"originBlock\":{\"x\":9,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200606,\"no\":97,\"originBlock\":{\"x\":8,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200606,\"no\":96,\"originBlock\":{\"x\":7,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200508,\"no\":95,\"originBlock\":{\"x\":6,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200208,\"no\":70,\"originBlock\":{\"x\":11,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":94,\"originBlock\":{\"x\":10,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":93,\"originBlock\":{\"x\":9,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":92,\"originBlock\":{\"x\":9,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":91,\"originBlock\":{\"x\":7,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":90,\"originBlock\":{\"x\":8,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":89,\"originBlock\":{\"x\":8,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":88,\"originBlock\":{\"x\":7,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200416,\"no\":87,\"originBlock\":{\"x\":6,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200415,\"no\":86,\"originBlock\":{\"x\":5,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200415,\"no\":85,\"originBlock\":{\"x\":2,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200415,\"no\":84,\"originBlock\":{\"x\":5,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200415,\"no\":83,\"originBlock\":{\"x\":6,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200415,\"no\":81,\"originBlock\":{\"x\":7,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200412,\"no\":80,\"originBlock\":{\"x\":8,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200412,\"no\":79,\"originBlock\":{\"x\":9,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200403,\"no\":78,\"originBlock\":{\"x\":10,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200306,\"no\":76,\"originBlock\":{\"x\":8,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200306,\"no\":75,\"originBlock\":{\"x\":9,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200213,\"no\":73,\"originBlock\":{\"x\":6,\"y\":3}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200213,\"no\":72,\"originBlock\":{\"x\":6,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200212,\"no\":71,\"originBlock\":{\"x\":6,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200208,\"no\":69,\"originBlock\":{\"x\":6,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200208,\"no\":68,\"originBlock\":{\"x\":6,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200208,\"no\":67,\"originBlock\":{\"x\":4,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200206,\"no\":66,\"originBlock\":{\"x\":4,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200113,\"no\":65,\"originBlock\":{\"x\":0,\"y\":13}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200113,\"no\":64,\"originBlock\":{\"x\":0,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200112,\"no\":63,\"originBlock\":{\"x\":1,\"y\":13}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200111,\"no\":62,\"originBlock\":{\"x\":2,\"y\":12}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200111,\"no\":61,\"originBlock\":{\"x\":3,\"y\":11}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200109,\"no\":60,\"originBlock\":{\"x\":3,\"y\":10}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200109,\"no\":59,\"originBlock\":{\"x\":3,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201503,\"no\":58,\"originBlock\":{\"x\":0,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201503,\"no\":57,\"originBlock\":{\"x\":0,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201502,\"no\":56,\"originBlock\":{\"x\":3,\"y\":7}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201502,\"no\":55,\"originBlock\":{\"x\":3,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201502,\"no\":54,\"originBlock\":{\"x\":0,\"y\":9}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":201502,\"no\":53,\"originBlock\":{\"x\":0,\"y\":8}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200814,\"no\":52,\"originBlock\":{\"x\":1,\"y\":6}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200813,\"no\":51,\"originBlock\":{\"x\":3,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200811,\"no\":50,\"originBlock\":{\"x\":3,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200701,\"no\":49,\"originBlock\":{\"x\":3,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200604,\"no\":48,\"originBlock\":{\"x\":2,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200517,\"no\":47,\"originBlock\":{\"x\":0,\"y\":0}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200413,\"no\":46,\"originBlock\":{\"x\":0,\"y\":2}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200408,\"no\":45,\"originBlock\":{\"x\":0,\"y\":4}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200408,\"no\":44,\"originBlock\":{\"x\":0,\"y\":5}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200406,\"no\":43,\"originBlock\":{\"x\":0,\"y\":10}}],\"regionId\":4},5:{\"furnitureList\":[{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200417,\"no\":-1,\"originBlock\":{\"x\":-1,\"y\":-1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200307,\"no\":42,\"originBlock\":{\"x\":4,\"y\":1}},{\"faceDirection\":1,\"floor\":false,\"furnitureId\":200305,\"no\":41,\"originBlock\":{\"x\":1,\"y\":1}}],\"regionId\":5}}";
            Map<Integer, WingRoomRegion> regionMap = JSONObject.parseObject(reStr, new TypeReference<Map<Integer, WingRoomRegion>>() {});
            for (WingRoomRegion region : regionMap.values()) {
                for (WingRoomFurniture furniture : region.getFurnitureList()) {
                    WingRoomFurnitureConfig furnitureConfig = WingRoomConfigMgr.getFurnitureConfig(furniture.getFurnitureId());
                    baseWindWater += furnitureConfig.getGeomancy();
                }
            }

            helper.setResult("【厢房命盘】计算风水等级上限：" + baseLimit + "。风水值：" + baseWindWater);
        }
        if (command.equals("/userKick")) {
            GamePlayerMgr.onLogout(player,true);
            helper.setResult("【玩家移出内存】");
        }
        if (command.equals("/kick")){
            helper.setResult("【踢出】执行成功");
            GamePlayerMgr.onLogout(player,true);
        }
        if (command.equals("/mkzl")) {
            List<UserPatrons> userPatronsList = player.getModule(PatronsModule.class).getUserPatronsList();
            // 降个序
            userPatronsList.sort(((o1, o2) -> o2.getAbility().compareTo(o1.getAbility())));
            List<BigInteger> randomSplitAbility = randomHelper.randomSplitAbility(new BigInteger(param), BigInteger.valueOf(1), 5, userPatronsList.size());
            for (UserPatrons userPatrons : userPatronsList) {
                if (randomSplitAbility.size() == 0) {
                    break;
                }
                userPatrons.setAddAbility(userPatrons.getAddAbility().add(randomSplitAbility.remove(0)));
            }
            player.getModule(PatronsModule.class).syncPatronsDataAll(true);
            helper.setResult("【门客】随机增加门客赚钱成功,增加赚钱:" + param);
        }
        if (command.equals("/clearBag")) {
            //清空背包
            Map<Integer, UserBagItem> map = player.getModule(BagModule.class).getUserBagItemMap();
            for (UserBagItem userBagItem : map.values()) {
                player.getModule(BagModule.class).removeBagItem(userBagItem.getGoodsId(), userBagItem.getNum(), eLogMoneyType.System);
            }
            helper.setResult("清空背包");
        }

        if (command.equals("/repair")) {
            AgentGeneral.repair(0, "repaircaishenbi");
            helper.setResult("【修复】执行成功");
        }
        if (command.equals("/谁在线啊")) {
            StringBuffer onlineUserStr = new StringBuffer();
            for (GamePlayer gamePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
                String nickName = gamePlayer.getUserInfo().getNickName();
                onlineUserStr.append(nickName).append(",\t");
            }
            helper.setResult("当前在线玩家:" + onlineUserStr);
        }

        if (command.startsWith("/zh2")) {
            ZhenHuanSecondProcessConfig config = ZhenHuanConfigMgr.getSecondProcessConfig();
            if (config == null || !ActivityHelper.activityInShowTime(config.getActivityInfo())) {
                throw new Exception("暂无甄嬛第二阶段活动");
            }
            if (command.startsWith("/zh2-setlv")) {
                int lv = Integer.parseInt(param);
                UserZhenHuanSecondProcessData userData = player.getModule(ZhenHuanSecondProcessModule.class).getUserData();
                userData.setLevel(lv);
                player.getModule(ZhenHuanSecondProcessModule.class).syncUserData();
            }

            if (command.startsWith("/zh2-setdegree")) {
                List<Integer> list = StringUtils.stringToIntegerList(param, "=");
                int love = list.get(0);
                int prestige = list.get(1);
                UserZhenHuanSecondProcessData userData = player.getModule(ZhenHuanSecondProcessModule.class).getUserData();
                userData.setLoveDegree(love);
                userData.setPrestigeDegree(prestige);
                player.getModule(ZhenHuanSecondProcessModule.class).syncUserData();
            }

            if (command.equals("/zh2-init")) {
                //初始二阶段的资格
                ZhenHuanFirstProcessConfig firstProcessConfig = ZhenHuanConfigMgr.getFirstProcessConfig();
                if (firstProcessConfig != null) {
                    GameZhenHuanPromotionData promotionData = ZhenHuanMgr.getPromotionData(firstProcessConfig.getActivityId());
                    Map<Long, ZhenHuanPromotionInfo> promotionInfoMap = promotionData.getPromotionInfoMap();
                    if (!promotionInfoMap.containsKey(player.getUserId())) {
                        ZhenHuanPromotionInfo zhenHuanPromotionInfo = new ZhenHuanPromotionInfo();
                        zhenHuanPromotionInfo.setUserId(player.getUserId());
                        zhenHuanPromotionInfo.setRank(1);
                        zhenHuanPromotionInfo.setParam("1");
                        zhenHuanPromotionInfo.setValue(BigInteger.ONE);
                        promotionInfoMap.put(player.getUserId(), zhenHuanPromotionInfo);
                        promotionData.setUpdateOption();
                    }
                    List<ZhenHuanProto.ZhenHuanPromotionTemp> zhenHuanPromotionTemps = ZhenHuanPb.parsePromotionTempList(new ArrayList<>(promotionInfoMap.values()));
                    ZhenHuanMgr.setPromotion(firstProcessConfig.getActivityId(), zhenHuanPromotionTemps);
                }
                player.getModule(ZhenHuanSecondProcessModule.class).syncUserData();
            }

            if (command.equals("/zh2-npc")) {
                // 转发上跨服
                ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.Builder builder = ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.newBuilder();
                builder.setActivityId(config.getActivityId());
                builder.setCode(helper.getCommand());
                builder.setParam(helper.getParam());
                player.sendPacket(Protocol.C_CROSS_ZHENHUAN_THIRD_PROCESS_DEBUG_CODE, builder);
            }

            helper.setResult("【甄嬛二阶段】指令执行成功!!!");
        }

        if (command.equals("/banquet")) {
            int goodsId = Integer.parseInt(param);
            if (GameConfig.BANQUET_CROSS_INVITATION_1 == goodsId || GameConfig.BANQUET_CROSS_INVITATION_2 == goodsId || GameConfig.BANQUET_CROSS_INVITATION_3 == goodsId){
                player.getModule(BanquetModule.class).getCrossBanquetInvitationReward(PropertyHelper.parsePropertyToString(new Property(goodsId, 1)), ""+ GameServer.getInstance().getServerId());
            }
            helper.setResult("获得宴会帖");
        }
        if  (command.startsWith("/testsuoyao")) {
            player.getModule(SuoYaoModule.class).exploreTreasureTestOne();
        }

        if (command.equals("/recombleader")) {
            Map<Integer, UserCombLeaderData> leaderDataMap = player.getModule(CombLeaderModule.class).getLeaderDataMap();
            for (UserCombLeaderData value : leaderDataMap.values()) {
                UserPatrons userPatrons = player.getModule(PatronsModule.class).getUserPatrons(value.getLeaderId());
                if (userPatrons != null) {
                    userPatrons.setLeaderPromotionId(0);
                    userPatrons.setLeaderKeepSakePatronsId(0);
                    userPatrons.setCombLeaderSkillList(new ArrayList<>());

                    patronsModule.syncPatronsCache(Collections.singletonList(userPatrons));

                    List<UserPatrons> keepSakeTargetPatronsIdPatronsList = patronsModule.getKeepSakeTargetPatronsIdPatronsList(value.getLeaderId());
                    for (UserPatrons patrons : keepSakeTargetPatronsIdPatronsList) {
                        if (patrons.getKeepSakePatronsId() > 0) {
                            patrons.setKeepSakePatronsId(0);
                            patrons.setKeepSakeTime(0);
                        } else {//通过魁首系统绑定的
                            UserCombLeaderData leaderData = player.getModule(CombLeaderModule.class).getUserCombLeaderDataByPatronsId(patrons.getPatronsId());
                            if (leaderData != null) {
                                leaderData.setKeepSakePatronsId(0);
                                leaderData.setKeepSakeTime(0);

                                patrons.setLeaderKeepSakePatronsId(0);
                            }
                        }
                    }
                    patronsModule.syncPatronsCache(keepSakeTargetPatronsIdPatronsList);
                }
                value.setLeaderId(0);
                value.setPromoteId(0);
                value.setKeepSakePatronsId(0);
                value.setKeepSakeTime(0);
                value.setLastChooseTime(0);
                value.setSkillMap(new ConcurrentHashMap<>());
            }
            player.getModule(CombLeaderModule.class).syncUserData();

            helper.setResult("重置组合首领系统");
        }

        if (command.equals("/mailTest")){
            String language = UserMgr.getLanguage(player.getUserId());
            String itemName = MultipleLanguageMgr.getContent("123321", language);
            String activityName = ServerLanguageMgr.getContent("123321", language);
            String mailTitle = MultipleLanguageMgr.getContent(MailManager.AUTO_USE_ABLE_ITEM_TITLE, language);
            String mailContent = StringUtils.format("안녕하세요. 이벤트 기간 동안 미사용한 \\{0\\}×{1}이(가) 일괄 회수되었습니다. 획득한 보상을 보내드리니 확인하시기 바랍니다.",
                    itemName, 1, activityName);
            MailManager.sendMail(player.getUserId(), eMailType.SYSTEM.getValue(), "", mailContent, mailTitle);
        }
        if (command.equals("/triggerGift")){
            List<Integer> integers = StringUtils.stringToIntegerList(param, "=");
            AssistantProto.AssistantRechargeNoticeReqMsg.Builder reqMsg = AssistantProto.AssistantRechargeNoticeReqMsg.newBuilder();
            reqMsg.setActivityId(integers.get(0));
            reqMsg.setConditionType(integers.get(1));
            player.sendPacket(GameProtocol.S_ASSISTANT_RECHARGE_NOTICE,reqMsg);
            helper.setResult("小玉触发现金礼包");
            helper.setFinish(true);
        }

        if (command.equals("/commondraw")) {
            String[] split = param.split("#");
            player.sendPacket(GameProtocol.S_ACTIVITY_LOTTERY_DRAW, ActivityLotteryProto.ActivityLotteryDrawReqMsg.newBuilder().setActivityId(Integer.parseInt(split[0])).setDrawCount(Integer.parseInt(split[1])));
            helper.setResult("通用活动抽奖");
        }

    }

    private static void initUser(GamePlayer player) {
        // 修改等级
        PlayerModule playerModule = player.getModule(PlayerModule.class);
        playerModule.getUserInfo().setTitleId(TitleMgr.getMaxTitleId());

        playerModule.onTitleChange();
        playerModule.onUserInfoChange();

        // 添加所有满级门客
        PatronsModule patronsModule = player.getModule(PatronsModule.class);
        for (PatronsInfo patronsInfo : PatronsMgr.getPatronsInfoMap().values()) {
            UserPatrons userPatrons = patronsModule.getUserPatrons(patronsInfo.getId());
            if (userPatrons == null) {
                userPatrons = patronsModule.addPatrons(patronsInfo.getId(), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            userPatrons.setBreakLv(PatronsMgr.getPatronsMaxBreakLv());
            int embroideryMeter = player.getModule(SkinVolumeModule.class).getSkinVolumeData().getEmbroideryMeter();
            int curMaxLv = PatronsMgr.getCurMaxLevel(userPatrons.getBreakLv(), userPatrons.getPatronsId(), embroideryMeter);
            userPatrons.setLevel(curMaxLv);
        }
        patronsModule.syncPatronsDataAll(false);


        // 添加所有美女
        BeautyModule beautyModule = player.getModule(BeautyModule.class);
        for (BeautyInfo beautyInfo : BeautyMgr.getBeautyInfoMap().values()) {
            UserBeauty userBeauty = beautyModule.getUserBeauty(beautyInfo.getBeautyId());
            if (userBeauty != null) {
                continue;
            }
            beautyModule.addBeauty(beautyInfo.getBeautyId(), eLogMoneyType.GM, eLogMoneyType.GM);
        }


        // 解锁府邸
        UserEstateWarData userEstateWarData = player.getModule(EstateWarModule.class).getUserEstateWarData();
        userEstateWarData.setType(randomHelper.next(2, 7));
        userEstateWarData.setPos(randomHelper.next(1, 101));
        int estateSkinId = ConfigMgr.getEstateSkinId(userEstateWarData.getType());
        userEstateWarData.setEstateSkinId(estateSkinId);
        player.getModule(EstateWarModule.class).syncUserEstateWarData();


        // 解锁所有商铺
        Map<Integer, BuildingInfo> buildingInfoMap = BuildingBussiness.getBuildingInfoMap();
        BuildingModule buildingModule = player.getModule(BuildingModule.class);
        for (int buildId : buildingInfoMap.keySet()) {
            buildingModule.addBuilding(buildId);
        }
        // 升级一下
        for (UserBuilding building : buildingModule.getBuildingMap().values()) {
            BuildingInfo buildingInfo = BuildingMgr.getBuildingInfo(building.getBuildingId());
            building.setLevel(BuildingMgr.getBuildingMaxLevel(player, buildingInfo.getOccupation()));
            building.setStaffCount(randomHelper.next(1, 50000));
        }
        buildingModule.syncBuilding(new ArrayList<>(buildingModule.getBuildingMap().values()), false);

        // 添加所有珍兽
        VehicleModule vehicleModule = player.getModule(VehicleModule.class);
        for (Integer vehicleId : VehicleMgr.getVehicleInfoMap().keySet()) {
            vehicleModule.addVehicle(vehicleId, 1, eLogMoneyType.GM, eLogMoneyType.GM);
        }

        // 庄园繁荣度
        ManorModule manorModule = player.getModule(ManorModule.class);
        manorModule.addProsperousValue(randomHelper.next(2000, 20000), "gm");
        manorModule.syncManorData();

        // 添加所有鱼类
        for (FishPondItemConfig fishPondItemConfig : FishPondMgr.getFishPondItemConfigMap().values()) {
            if (fishPondItemConfig.getType() != 1) {
                continue;
            }
            int randomFishWeight = FishPondMgr.randomFishWeight(fishPondItemConfig);
            manorModule.getManorFishPondModel().addFish(fishPondItemConfig, randomFishWeight, false);
        }
        manorModule.getManorFishPondModel().init();

        // 随机一下关卡
        PassRoadModule passRoadModule = player.getModule(PassRoadModule.class);
        UserPassRoad userPassRoad = passRoadModule.getUserPassRoad();
        userPassRoad.setPassId(randomHelper.next(200, 2000));
        passRoadModule.initPassRoadSystem();

        // 添加所有蛐蛐(会弹窗，不要了)
//        CricketModule cricketModule = player.getModule(CricketModule.class);
//        for (CricketConfig cricketConfig : CricketMgr.getConfig().getCricketConfigMap().values()) {
//            player.getModule(CurrencyModule.class).addCurrency(new Property(cricketConfig.getId(), 9999), eLogMoneyType.GM, eLogMoneyType.GM);
//        }
//        cricketModule.syncData();

        // 装饰来一份
//        Map<Integer, Map<Integer, DecorationInfo>> dataTypeMap = new ConcurrentHashMap<>();
//        Map<Integer, DecorationInfo> dataMap = new ConcurrentHashMap<>();
//        DecorationBussiness.getDecorationInfoMap(dataTypeMap, dataMap);
//        for (DecorationInfo decorationInfo : dataMap.values()) {
//            player.getModule(CurrencyModule.class).addCurrency(new Property(decorationInfo.getId(), 1), eLogMoneyType.GM, eLogMoneyType.GM);
//        }

        // 元宝来一点
        player.getModule(CurrencyModule.class).addCurrency(new Property(GameConfig.GAME_MONEY_INGOTS, randomHelper.next(1, 999999999)), eLogMoneyType.GM, eLogMoneyType.GM);
    }

    /**
     * 瓦舍
     */
    private static void washe(GamePlayer player, CommandHelper helper) {
        if (helper.isFinish()) {
            return;
        }
        String command = helper.getCommand();
        String param = helper.getParam();
        CurrencyModule currencyModule = player.getModule(CurrencyModule.class);
        WasheModule washeModule = player.getModule(WasheModule.class);
        WasheUserData washeUserData = washeModule.getWasheUserData();
        WasheConfig washeConfig = WasheMgr.getWasheConfig();
        if (command.equals("/wsjf")) {
            washeModule.changeScore(washeConfig, washeUserData, Long.parseLong(param));
            washeModule.refreshData();
            helper.setResult("【掌柜夺魁】增加积分成功,增加积分:" + Long.parseLong(param) + ",当前积分:" + washeUserData.getScore());
        }
        if (command.equals("/wsylk")) {
            for (WasheCardConfig cardConfig : washeConfig.getCardConfigMap().values()) {
                currencyModule.addCurrency(new Property(cardConfig.getItemId(), 1), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            helper.setResult("【掌柜夺魁】解锁所有优伶卡成功");
        }
        if (command.equals("/wstjylk")) {
            for (WasheCardConfig cardConfig : washeConfig.getCardConfigMap().values()) {
                currencyModule.addCurrency(new Property(cardConfig.getItemId(), Long.parseLong(param)), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            helper.setResult("【掌柜夺魁】添加所有优伶卡成功,增加数量:" + Long.parseLong(param));
        }
        if (command.equals("/wscztx")) {
            washeUserData.setDaySurrenderTimes(0);
            washeModule.refreshData();
            helper.setResult("【掌柜夺魁】重置投降次数成功");
        }
        if (command.equals("/yz")) {
            snowDrawTest();
            player.getModule(VerificationModule.class).verificationDatasync(eSystemId.WasheActivity.getValue());
            helper.setResult("【人机验证】推送验证信息");
        }
    }


    /**
     * 蛐蛐
     */
    private static void cricket(GamePlayer player, CommandHelper helper) {
        if (helper.isFinish()) {
            return;
        }
        String command = helper.getCommand();
        String param = helper.getParam();
        CricketModule cricketModule = player.getModule(CricketModule.class);
        Set<Integer> cricketIdList = CricketMgr.getConfig().getCricketConfigMap().keySet();
        // 蛐蛐一键升阶
        if (command.equals("/qqyjsj")) {
            UserCricketData userCricketData = cricketModule.getUserCricketData();
            Map<Integer, BigInteger> goods = userCricketData.getItems().getGoods();
            Map<Integer, BigInteger> temp = new ConcurrentHashMap<>(goods);
            for (Map.Entry<Integer, BigInteger> entry : temp.entrySet()) {
                Integer goodsId = entry.getKey();
                if (cricketIdList.contains(goodsId)) {
                    for (int i = 0; i < entry.getValue().intValue(); i++) {
                        cricketModule.cricketUpgrade(goodsId);
                    }
                }
            }
            helper.setResult("【蛐蛐】所有蛐蛐升阶成功");
        }
        // 添加所有蛐蛐
        if (command.equals("/tjsyqq")) {
            long count = Long.parseLong(param);
            Set<Integer> set = CricketMgr.getConfig().getCricketConfigMap().keySet();
            for (Integer cricketId : set) {
                player.getModule(CurrencyModule.class).addCurrency(new Property(cricketId, count), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            cricketModule.syncData();
            helper.setResult("【蛐蛐】增加所有蛐蛐成功，数量:" + count);
        }
        // 添加所有无双蛐蛐
        if (command.equals("/initqq")) {
            int i = 0;
            for (CricketConfig cricketConfig : CricketMgr.getConfig().getCricketConfigMap().values()) {
                if (i >= 9) {
                    break;
                }
                if (cricketConfig.getQuality() != 5) {
                    continue;
                }
                i++;
                player.getModule(CurrencyModule.class).addCurrency(new Property(cricketConfig.getId(), 1), eLogMoneyType.GM, eLogMoneyType.GM);
            }
            cricketModule.syncData();
            helper.setResult("【蛐蛐】增加防守蛐蛐成功");
        }
        if (command.equals("/testBattle")) {
            AgentCricket agentCricket = new AgentCricket();
            agentCricket.cricketBattle(null);
            helper.setResult("【蛐蛐】testBattle成功");
        }
        if (command.equals("/cricketTest")) {
            Path path = Paths.get(param);
            Cricket.getInstance().run(path);
            helper.setResult("【蛐蛐】战斗测试结果已输出");
        }
        if (command.equals("/ruishou")) {
            List<Integer> integers = StringUtils.stringToIntegerList(param, "#");
            player.getModule(RuiShouModule.class).mockTest(integers.get(0), integers.get(1));
        }
    }

    public static List<JSONObject> snowDrawTest() {
        SnowGardenConfig snowGardenConfig = SnowGardenMgr.getSnowGardenConfig();
        List<JSONObject> runResultList= new ArrayList<>();
        //阶段一和阶段二分别使用78个，225个，408个，1048个活动道具，达到的建筑总等级和邀请宾客人数
        List<Integer> testTimesList = Arrays.asList(78, 225, 408, 1048);
        Long fakeUserMax = 1000L;

        boolean isSkip = true;
        List<Integer> number = new ArrayList<>();
        List<SnowGardenUserData> fakeUserDataList = new ArrayList<>();
        long startTime = DateHelper.getCurrentTime();
        for (Integer testTimes : testTimesList) {
            int period = 1;
            for (long fakeUserId = 1; fakeUserId <= fakeUserMax; fakeUserId++) {
                int times = testTimes;
                // 准备数据
                SnowGardenUserData snowGardenUserData = SnowGardenMgr.createUserData(fakeUserId);
                fakeUserDataList.add(snowGardenUserData);
                // 随机结果
                List<Integer> randomResultList = new ArrayList<>();
                // 邀请角色ID列表
                List<Integer> invitedIdList = new ArrayList<>();
                // 事件邀请角色ID列表
                List<Integer> combInvitedIdList = new ArrayList<>();
                // 触发的事件
                List<SnowGardenCombTriggerData> combList = new ArrayList<>();
                // 奖励积分数量
                int awardScore = 0;
                int randomNum = 0;
                // 事件奖励
                Property property = new Property();
                // 骰子随机奖励
                List<String> randomAward = new ArrayList<>();
                // 记录前进步数
                int sumStep = 0;
                // 记录初始位置(客户端需求)
                int recordIndex = snowGardenUserData.getIndexNum();

                // 一圈的长度
                int mapStepNumb = snowGardenConfig.getMapSize();


                // 皮肤倍率+ 阶段倍率
                BigDecimal radio = SnowGardenMgr.calcSkinRadio(snowGardenUserData.getSkinList(), snowGardenUserData.getIndexData(), period);


                while (times > 0) {
                    // 阶段1走到这个地块上升级建筑
                    if (period == eSnowGardenPeriodType.UPGRADE_PERIOD.getType()) {
                        randomNum = SnowGardenMgr.randomOneStep(SnowGardenMgr.rollNum, number, times, snowGardenUserData);
                        randomResultList.add(randomNum);
                        int nowIndex = snowGardenUserData.getIndexNum();
                        sumStep += randomNum;
                        int newIndex = nowIndex + randomNum;
                        if (newIndex > mapStepNumb) {
                            // 如果超过地图的长度则圈数+1，从1开始走
                            newIndex -= mapStepNumb;
                        }
                        snowGardenUserData.setIndexNum(newIndex);
                        int indexType = snowGardenConfig.getIndexType(newIndex);
                        int configScore = snowGardenConfig.getScoreByIndex(newIndex);
                        if (indexType == eSnowGardenMapType.LONG_PLOT.getType()) {
                            // 升级建筑
                            SnowGardenMapData mapData = snowGardenUserData.getIndexData().get(newIndex);
                            mapData.setLevel(mapData.getLevel() + 1);
                        }
                        awardScore += BigDecimal.valueOf(configScore).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                    } else {
                        // 二阶段邀请门客、美女
                        randomNum = SnowGardenMgr.randomOneStep(SnowGardenMgr.secondRollNum, number, times, snowGardenUserData);
                        randomResultList.add(randomNum);

                        int id = snowGardenConfig.randomVisitorConfigId();
                        int configScore = snowGardenConfig.getVisitorScore(id);
                        BigDecimal scoreWithRadio = BigDecimal.valueOf(configScore).multiply(radio).setScale(0, RoundingMode.CEILING); // CEILING模式用于实现向上取整
                        awardScore += scoreWithRadio.intValue();

                        List<Integer> invitedList = snowGardenUserData.getInvitedIdList();
                        if (invitedList.size() >= snowGardenConfig.getVisitCountMax()) {
                            invitedList.remove(0); // 移除头个
                        }
                        invitedList.add(snowGardenConfig.getVisitorId(id));
                        invitedIdList.add(snowGardenConfig.getVisitorId(id));
                        snowGardenUserData.setInvitedIdList(invitedList);
                    }

                    // 判断九格的三消
                    List<Integer> resultList = snowGardenUserData.getResultList();
                    SnowGardenResultCombData snowGardenResultCombData = SnowGardenMgr.calcResultComb(resultList, randomNum);
                    int combId = 0;
                    for (int combMapKey : snowGardenConfig.getSnowGardenCombConfig().keySet()) {
                        if (snowGardenConfig.checkComb(combMapKey, period, randomNum)) {
                            combId = combMapKey;
                            break;
                        }
                    }

                    // 开始触发事件列表
                    SnowGardenCombTriggerData triggerData = new SnowGardenCombTriggerData();
                    int combCount = snowGardenResultCombData.getCombCount();
                    // 优化：（多次）奖励事件改为相同道具 x 次数,仅随机一次
                    Property p = snowGardenConfig.getCombReward(combId);
                    for (int i = 0; i < combCount; i++) {
                        triggerData.setCombId(combId);
                        int param = snowGardenConfig.getCombParam(combId);
                        if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_ONE.getId()) {
//                    param = (int)Math.ceil(param * radio);
                            param = BigDecimal.valueOf(param).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                            awardScore += param;
                            triggerData.addParam(String.valueOf(param));
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_TWO.getId()) {
                            int newIndex = snowGardenUserData.getIndexNum();
                            sumStep += param;
                            List<Integer> recordIndexList = new ArrayList<>();
                            for (int j = 1; j <= param; j++) {
                                newIndex++;
                                if (newIndex > mapStepNumb) {
                                    // 如果超过地图的长度则圈数+1，从1开始走
                                    newIndex -= mapStepNumb;
                                }
                                int indexType = snowGardenConfig.getIndexType(newIndex);
                                int configScore = snowGardenConfig.getScoreByIndex(newIndex);
                                awardScore += BigDecimal.valueOf(configScore).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                                recordIndexList.add(newIndex);
                                Map<Integer, SnowGardenMapData> map = snowGardenUserData.getIndexData();
                                if (indexType == eSnowGardenMapType.LONG_PLOT.getType()) {
                                    // 升级建筑
                                    SnowGardenMapData combMap = map.get(newIndex);
                                    combMap.setLevel(combMap.getLevel() + 1);
                                }
                            }
                            snowGardenUserData.setIndexNum(newIndex);
                            String newParam = StringUtils.listToString(recordIndexList, ";");
                            triggerData.addParam(String.valueOf(param));
                            triggerData.addSkipParam(newParam);
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_THREE.getId()) {
                            Property buildingProperty = new Property(snowGardenConfig.getBuildItemId(), param);
                            property.addProperty(buildingProperty);
                            triggerData.addParam(String.valueOf(param));
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_FOUR.getId()) {
                            int newIndex = snowGardenUserData.getIndexNum();
                            Map<Integer, SnowGardenMapData> newMap = snowGardenUserData.getIndexData();
                            SnowGardenMapData combMap = newMap.get(newIndex);
                            combMap.setLevel(combMap.getLevel() + param);
                            int configScore = snowGardenConfig.getScoreByIndex(newIndex);
//                    awardScore += (int)Math.ceil(statueConfig.getScore() * radio);
                            awardScore += BigDecimal.valueOf(configScore * param).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                            triggerData.addParam(String.valueOf(param));
                            if (isSkip) {
                                triggerData.addSkipParam(String.valueOf(newIndex));
                            }
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_FIVE.getId()) {
                            // 随机商会好友(除自己) 还要排除没开活动的
                            CrossUnionMember unionMember = null;
                            // 未加入商会则无拜访列表
                            if (unionMember == null) {
//                        param = (int)Math.ceil(snowGardenConfig.getNoUnionComb4Score() * radio);
                                param = BigDecimal.valueOf(snowGardenConfig.getNoUnionComb4Score()).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                                awardScore += param;
                                triggerData.addParam(String.valueOf(param));
                            }
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_SIX.getId()) {
                            property.addProperty(p);
                            triggerData.addParam(PropertyHelper.parsePropertyToString(p));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_ONE.getId()) {
//                    int paramScore = (int)Math.ceil(param * radio);
                            int paramScore = BigDecimal.valueOf(param).multiply(radio).setScale(0, BigDecimal.ROUND_CEILING).intValue();
                            awardScore += paramScore;
                            triggerData.addParam(String.valueOf(paramScore));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_TWO.getId()) {
                            Property combOneAward = new Property(snowGardenConfig.getVisitItemId(), param);
                            property.addProperty(combOneAward);
                            triggerData.addParam(String.valueOf(param));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_THREE.getId()) {
                            int randomId = SnowGardenMgr.randomOneMoreVisitor();
                            int randomVisitorId = snowGardenConfig.getVisitorId(randomId);
                            int repeatedScore = snowGardenConfig.getVisitorScore(randomId);
//                    awardScore += (int)Math.ceil(repeatedScore * param * radio);
                            awardScore += BigDecimal.valueOf(repeatedScore).multiply(BigDecimal.valueOf(param)).multiply(radio).setScale(0, BigDecimal.ROUND_CEILING).intValue();
                            List<Integer> invitedList = snowGardenUserData.getInvitedIdList();
                            if (invitedList.size() >= snowGardenConfig.getVisitCountMax()) {
                                invitedList.remove(0); // 移除头个
                            }
                            invitedList.add(randomVisitorId);
                            combInvitedIdList.add(randomVisitorId);
                            triggerData.addParam(String.valueOf(randomVisitorId));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_FOUR.getId()) {
                            // 随机商会好友(除自己)
                            CrossUnionMember unionMember = null;
                            // 未加入商会则无拜访列表
                            if (unionMember == null) {
//                        param = (int)Math.ceil(snowGardenConfig.getNoUnionComb10Score()* radio);
                                param = BigDecimal.valueOf(snowGardenConfig.getNoUnionComb10Score()).multiply(radio).setScale(0, BigDecimal.ROUND_CEILING).intValue();
                                awardScore += param;
                                triggerData.addParam(String.valueOf(param));
                            }
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_FIVE.getId()) {
                            property.addProperty(p);
                            // 这里要重设返回值
                            triggerData.addParam(PropertyHelper.parsePropertyToString(p));
                        }
                    }
                    combList.add(triggerData);


                    if (combCount > 0) {
                        snowGardenUserData.setGuarantee(SnowGardenMgr.randomGuarantee(period));
                    } else if (snowGardenUserData.getDice().size() == 0) {
                        // 需要当模板走完之后才开始正常的保底计数
                        snowGardenUserData.setGuarantee(snowGardenUserData.getGuarantee() - 1);
                    }
                    snowGardenUserData.setResultList(snowGardenResultCombData.getResultList());
                    Property randomRollAward = SnowGardenMgr.getRollReward(period);
                    property.addProperty(randomRollAward);
                    randomAward.add(PropertyHelper.parsePropertyToString(randomRollAward));
                    times--;
                }

                snowGardenUserData.setLoopNum(snowGardenUserData.getLoopNum() + randomResultList.size());
                snowGardenUserData.addScore(period, awardScore);
                snowGardenUserData.setUpdateOption();

                snowGardenUserData.addInviteNum(invitedIdList.size() + combInvitedIdList.size());
            }

            period = 2;
            for (long fakeUserId = 1; fakeUserId <= fakeUserMax; fakeUserId++) {
                int times = testTimes;
                // 准备数据
                SnowGardenUserData snowGardenUserData = SnowGardenMgr.createUserData(fakeUserId);
                fakeUserDataList.add(snowGardenUserData);
                // 随机结果
                List<Integer> randomResultList = new ArrayList<>();
                // 邀请角色ID列表
                List<Integer> invitedIdList = new ArrayList<>();
                // 事件邀请角色ID列表
                List<Integer> combInvitedIdList = new ArrayList<>();
                // 触发的事件
                List<SnowGardenCombTriggerData> combList = new ArrayList<>();
                // 奖励积分数量
                int awardScore = 0;
                int randomNum = 0;
                // 事件奖励
                Property property = new Property();
                // 骰子随机奖励
                List<String> randomAward = new ArrayList<>();
                // 记录前进步数
                int sumStep = 0;
                // 记录初始位置(客户端需求)
                int recordIndex = snowGardenUserData.getIndexNum();

                // 一圈的长度
                int mapStepNumb = snowGardenConfig.getMapSize();


                // 皮肤倍率+ 阶段倍率
                BigDecimal radio = SnowGardenMgr.calcSkinRadio(snowGardenUserData.getSkinList(), snowGardenUserData.getIndexData(), period);


                while (times > 0) {
                    // 阶段1走到这个地块上升级建筑
                    if (period == eSnowGardenPeriodType.UPGRADE_PERIOD.getType()) {
                        randomNum = SnowGardenMgr.randomOneStep(SnowGardenMgr.rollNum, number, times, snowGardenUserData);
                        randomResultList.add(randomNum);
                        int nowIndex = snowGardenUserData.getIndexNum();
                        sumStep += randomNum;
                        int newIndex = nowIndex + randomNum;
                        if (newIndex > mapStepNumb) {
                            // 如果超过地图的长度则圈数+1，从1开始走
                            newIndex -= mapStepNumb;
                        }
                        snowGardenUserData.setIndexNum(newIndex);
                        int indexType = snowGardenConfig.getIndexType(newIndex);
                        int configScore = snowGardenConfig.getScoreByIndex(newIndex);
                        if (indexType == eSnowGardenMapType.LONG_PLOT.getType()) {
                            // 升级建筑
                            SnowGardenMapData mapData = snowGardenUserData.getIndexData().get(newIndex);
                            mapData.setLevel(mapData.getLevel() + 1);
                        }
                        awardScore += BigDecimal.valueOf(configScore).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                    } else {
                        // 二阶段邀请门客、美女
                        randomNum = SnowGardenMgr.randomOneStep(SnowGardenMgr.secondRollNum, number, times, snowGardenUserData);
                        randomResultList.add(randomNum);

                        int id = snowGardenConfig.randomVisitorConfigId();
                        int configScore = snowGardenConfig.getVisitorScore(id);
                        BigDecimal scoreWithRadio = BigDecimal.valueOf(configScore).multiply(radio).setScale(0, RoundingMode.CEILING); // CEILING模式用于实现向上取整
                        awardScore += scoreWithRadio.intValue();

                        List<Integer> invitedList = snowGardenUserData.getInvitedIdList();
                        if (invitedList.size() >= snowGardenConfig.getVisitCountMax()) {
                            invitedList.remove(0); // 移除头个
                        }
                        invitedList.add(snowGardenConfig.getVisitorId(id));
                        invitedIdList.add(snowGardenConfig.getVisitorId(id));
                        snowGardenUserData.setInvitedIdList(invitedList);
                    }

                    // 判断九格的三消
                    List<Integer> resultList = snowGardenUserData.getResultList();
                    SnowGardenResultCombData snowGardenResultCombData = SnowGardenMgr.calcResultComb(resultList, randomNum);
                    int combId = 0;
                    for (int combMapKey : snowGardenConfig.getSnowGardenCombConfig().keySet()) {
                        if (snowGardenConfig.checkComb(combMapKey, period, randomNum)) {
                            combId = combMapKey;
                            break;
                        }
                    }

                    // 开始触发事件列表
                    SnowGardenCombTriggerData triggerData = new SnowGardenCombTriggerData();
                    int combCount = snowGardenResultCombData.getCombCount();
                    // 优化：（多次）奖励事件改为相同道具 x 次数,仅随机一次
                    Property p = snowGardenConfig.getCombReward(combId);
                    for (int i = 0; i < combCount; i++) {
                        triggerData.setCombId(combId);
                        int param = snowGardenConfig.getCombParam(combId);
                        if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_ONE.getId()) {
//                    param = (int)Math.ceil(param * radio);
                            param = BigDecimal.valueOf(param).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                            awardScore += param;
                            triggerData.addParam(String.valueOf(param));
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_TWO.getId()) {
                            int newIndex = snowGardenUserData.getIndexNum();
                            sumStep += param;
                            List<Integer> recordIndexList = new ArrayList<>();
                            for (int j = 1; j <= param; j++) {
                                newIndex++;
                                if (newIndex > mapStepNumb) {
                                    // 如果超过地图的长度则圈数+1，从1开始走
                                    newIndex -= mapStepNumb;
                                }
                                int indexType = snowGardenConfig.getIndexType(newIndex);
                                int configScore = snowGardenConfig.getScoreByIndex(newIndex);
                                awardScore += BigDecimal.valueOf(configScore).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                                recordIndexList.add(newIndex);
                                Map<Integer, SnowGardenMapData> map = snowGardenUserData.getIndexData();
                                if (indexType == eSnowGardenMapType.LONG_PLOT.getType()) {
                                    // 升级建筑
                                    SnowGardenMapData combMap = map.get(newIndex);
                                    combMap.setLevel(combMap.getLevel() + 1);
                                }
                            }
                            snowGardenUserData.setIndexNum(newIndex);
                            String newParam = StringUtils.listToString(recordIndexList, ";");
                            triggerData.addParam(String.valueOf(param));
                            triggerData.addSkipParam(newParam);
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_THREE.getId()) {
                            Property buildingProperty = new Property(snowGardenConfig.getBuildItemId(), param);
                            property.addProperty(buildingProperty);
                            triggerData.addParam(String.valueOf(param));
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_FOUR.getId()) {
                            int newIndex = snowGardenUserData.getIndexNum();
                            Map<Integer, SnowGardenMapData> newMap = snowGardenUserData.getIndexData();
                            SnowGardenMapData combMap = newMap.get(newIndex);
                            combMap.setLevel(combMap.getLevel() + param);
                            int configScore = snowGardenConfig.getScoreByIndex(newIndex);
//                    awardScore += (int)Math.ceil(statueConfig.getScore() * radio);
                            awardScore += BigDecimal.valueOf(configScore * param).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                            triggerData.addParam(String.valueOf(param));
                            if (isSkip) {
                                triggerData.addSkipParam(String.valueOf(newIndex));
                            }
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_FIVE.getId()) {
                            // 随机商会好友(除自己) 还要排除没开活动的
                            CrossUnionMember unionMember = null;
                            // 未加入商会则无拜访列表
                            if (unionMember == null) {
//                        param = (int)Math.ceil(snowGardenConfig.getNoUnionComb4Score() * radio);
                                param = BigDecimal.valueOf(snowGardenConfig.getNoUnionComb4Score()).multiply(radio).setScale(0, RoundingMode.CEILING).intValue();
                                awardScore += param;
                                triggerData.addParam(String.valueOf(param));
                            }
                        } else if (combId == eSnowGardenCombType.FIRST_PERIOD_COMB_SIX.getId()) {
                            property.addProperty(p);
                            triggerData.addParam(PropertyHelper.parsePropertyToString(p));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_ONE.getId()) {
//                    int paramScore = (int)Math.ceil(param * radio);
                            int paramScore = BigDecimal.valueOf(param).multiply(radio).setScale(0, BigDecimal.ROUND_CEILING).intValue();
                            awardScore += paramScore;
                            triggerData.addParam(String.valueOf(paramScore));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_TWO.getId()) {
                            Property combOneAward = new Property(snowGardenConfig.getVisitItemId(), param);
                            property.addProperty(combOneAward);
                            triggerData.addParam(String.valueOf(param));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_THREE.getId()) {
                            int randomId = SnowGardenMgr.randomOneMoreVisitor();
                            int randomVisitorId = snowGardenConfig.getVisitorId(randomId);
                            int repeatedScore = snowGardenConfig.getVisitorScore(randomId);
//                    awardScore += (int)Math.ceil(repeatedScore * param * radio);
                            awardScore += BigDecimal.valueOf(repeatedScore).multiply(BigDecimal.valueOf(param)).multiply(radio).setScale(0, BigDecimal.ROUND_CEILING).intValue();
                            List<Integer> invitedList = snowGardenUserData.getInvitedIdList();
                            if (invitedList.size() >= snowGardenConfig.getVisitCountMax()) {
                                invitedList.remove(0); // 移除头个
                            }
                            invitedList.add(randomVisitorId);
                            combInvitedIdList.add(randomVisitorId);
                            triggerData.addParam(String.valueOf(randomVisitorId));
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_FOUR.getId()) {
                            // 随机商会好友(除自己)
                            CrossUnionMember unionMember = null;
                            // 未加入商会则无拜访列表
                            if (unionMember == null) {
//                        param = (int)Math.ceil(snowGardenConfig.getNoUnionComb10Score()* radio);
                                param = BigDecimal.valueOf(snowGardenConfig.getNoUnionComb10Score()).multiply(radio).setScale(0, BigDecimal.ROUND_CEILING).intValue();
                                awardScore += param;
                                triggerData.addParam(String.valueOf(param));
                            }
                        } else if (combId == eSnowGardenCombType.SECOND_PERIOD_COMB_FIVE.getId()) {
                            property.addProperty(p);
                            // 这里要重设返回值
                            triggerData.addParam(PropertyHelper.parsePropertyToString(p));
                        }
                    }
                    combList.add(triggerData);


                    if (combCount > 0) {
                        snowGardenUserData.setGuarantee(SnowGardenMgr.randomGuarantee(period));
                    } else if (snowGardenUserData.getDice().size() == 0) {
                        // 需要当模板走完之后才开始正常的保底计数
                        snowGardenUserData.setGuarantee(snowGardenUserData.getGuarantee() - 1);
                    }
                    snowGardenUserData.setResultList(snowGardenResultCombData.getResultList());
                    Property randomRollAward = SnowGardenMgr.getRollReward(period);
                    property.addProperty(randomRollAward);
                    randomAward.add(PropertyHelper.parsePropertyToString(randomRollAward));
                    times--;
                }

                snowGardenUserData.setLoopNum(snowGardenUserData.getLoopNum() + randomResultList.size());
                snowGardenUserData.addScore(period, awardScore);
                snowGardenUserData.setUpdateOption();

                snowGardenUserData.addInviteNum(invitedIdList.size() + combInvitedIdList.size());
            }

            int maxBuildingLevel = 0;
            int minBuildingLevel = 0;
            BigDecimal avgBuildingLevel = BigDecimal.ZERO;
            int totalBuildingLevel = 0;
            for (SnowGardenUserData userData : fakeUserDataList) {
                int buildingLevel = userData.getBuildingLevel();
                if (buildingLevel > maxBuildingLevel) {
                    maxBuildingLevel = buildingLevel;
                }
                if (buildingLevel < minBuildingLevel || minBuildingLevel == 0) {
                    minBuildingLevel = buildingLevel;
                }
                totalBuildingLevel += buildingLevel;
            }
            avgBuildingLevel = BigDecimal.valueOf(totalBuildingLevel).divide(BigDecimal.valueOf(fakeUserDataList.size()), 2, BigDecimal.ROUND_HALF_UP);

            int maxInviteNum = 0;
            int minInviteNum = 0;
            BigDecimal avgInviteNum = BigDecimal.ZERO;
            int totalInviteNum = 0;
            for (SnowGardenUserData userData : fakeUserDataList) {
                int inviteNum = userData.getInvitedNum();
                if (inviteNum > maxInviteNum) {
                    maxInviteNum = inviteNum;
                }
                if (inviteNum < minInviteNum || minInviteNum == 0) {
                    minInviteNum = inviteNum;
                }
                totalInviteNum += inviteNum;
            }
            avgInviteNum = BigDecimal.valueOf(totalInviteNum).divide(BigDecimal.valueOf(fakeUserDataList.size()), 2, BigDecimal.ROUND_HALF_UP);

            JSONObject resultObj = new JSONObject();
            resultObj.put("times", testTimes);
            resultObj.put("maxBuildingLevel", maxBuildingLevel);
            resultObj.put("minBuildingLevel", minBuildingLevel);
            resultObj.put("avgBuildingLevel", avgBuildingLevel.toString());
            resultObj.put("maxInviteNum", maxInviteNum);
            resultObj.put("minInviteNum", minInviteNum);
            resultObj.put("avgInviteNum", avgInviteNum.toString());

            runResultList.add(resultObj);
        }

        long endTime = DateHelper.getCurrentTime();

        SnowGardenMgr.getLogger().info("------cost time = {}", endTime - startTime);

        return runResultList;

    }

    private static void biaoJu(GamePlayer player, CommandHelper helper) {
        String command = helper.getCommand();
        String param = helper.getParam();
        if (!command.startsWith("/bj")) {
            return;
        }
        if (helper.isFinish()) {
            return;
        }
        BiaoJuConfig config = BiaoJuConfigMgr.getConfig();
        if (config == null) {
            helper.setResult("第一镖局活动未开启");
            return;
        }
        int groupId = GameUnionActivityGroupMgr.getGroupId(config.getActivityId(), player.getUserId());
        if (groupId == UnionActivityGroupHelper.NO_GROUP_ID) {
            helper.setResult("第一镖局没有活动资格");
            return;
        }

        helper.setResult("第一镖局指令设置了");


        ActivityBiaoJuModule module = player.getModule(ActivityBiaoJuModule.class);
        if (command.equals("/bj-test")) {

            BiaoJuProto.BiaoJuGetMyEscortInfoReqMsg.Builder reqMsg = BiaoJuProto.BiaoJuGetMyEscortInfoReqMsg.newBuilder();
            reqMsg.setActivityId(config.getActivityId());

            player.sendUnionActivityGroupPacket(CrossProtocol.C_BIAOJU_GET_MY_ESCORT_INFO, reqMsg, config.getActivityId(), groupId);
            helper.setResult("发送获取我的镖局信息请求");
        }

        if (command.equals("/bj-highnum")) {
            //统计所有的镖师等级对应人数
            Property titleNum = new Property();
            Property highQualityNum = new Property();

            for (BiaoJuTitleConfig titleConfig : config.getTitleConfigMap().values()) {
                titleNum.addProperty(titleConfig.getId(), 2);
            }

            //每个品质的高级镖单的数量=累计(等级镖师人数*镖师系数)*镖单系数，有保底
            for (int quality = config.getHighQualityDefine(); quality <= config.getMaxQuality(); quality++) {
                BigDecimal titleAmount = BigDecimal.ZERO;
                for (BiaoJuTitleConfig titleConfig : config.getTitleConfigMap().values()) {
                    BigDecimal titleHighParam = BigDecimal.valueOf(titleConfig.getHighDartParamProperty().getCountByGoodsId(quality).intValue());
                    BigDecimal takeNum = BigDecimal.valueOf(titleNum.getCountByGoodsId(titleConfig.getId()).intValue());
                    titleAmount = titleAmount.add(takeNum.multiply(titleHighParam).divide(BigDecimal.valueOf(1000), 8, BigDecimal.ROUND_DOWN));
                }
                int highQualityEscortParam1 = config.getHighQualityEscortParam1(quality);
                BigDecimal result = titleAmount.multiply(BigDecimal.valueOf(highQualityEscortParam1)).divide(BigDecimal.valueOf(1000));
                int createNum = result.setScale(0, BigDecimal.ROUND_UP).intValue();
                int minNum = config.getHighQualityEscortMinNum(quality);
                if (createNum < minNum) {
                    createNum = minNum;
                }

                highQualityNum.addProperty(quality, createNum);
            }
            String content = String.format("镖师数量: %s\r\n 优质镖数量: %s", titleNum.toHelperString(), highQualityNum.toHelperString());
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(), content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);

            helper.setResult("优质镖数量生成测试");
        }

        if (command.equals("/bj-money") ||
                command.equals("/bj-level") ||
                command.equals("/bj-best")) {
            ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.Builder builder = ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.newBuilder();
            builder.setActivityId(config.getActivityId());
            builder.setCode(helper.getCommand());
            builder.setParam(helper.getParam());
            player.sendUnionActivityGroupPacket(CrossProtocol.C_BIAOJU_DEBUG_CMD, builder, config.getActivityId(), groupId);
        }
    }

    private static void foxCard(GamePlayer player, CommandHelper helper) {
        String command = helper.getCommand();
        String param = helper.getParam();
        if (!command.startsWith("/fox")) {
            return;
        }

        FoxCardConfig config = FoxCardMgr.getConfig();
        if (config == null) {
            return;
        }
        UserFoxCardGameData gameData = player.getModule(FoxCardModule.class).getUserGameData();
        FoxCardGameLogic gameLogic = new FoxCardGameLogic(config, gameData);
        if (command.equals("/foxadd")) {
            List<Integer> list = StringUtils.stringToIntegerList(param, "=");
            int cardType = list.get(0);
            if (cardType == eFoxCardType.EFFECT.getValue()) {
                if (list.size() > 1) {
                    Integer cardId = list.get(1);
                    int versionEffect = 0;
                    if (list.size() > 2) {
                        versionEffect = list.get(2);
                    }

                    if (cardId > 0) {
                        FoxCardEffectCardConfig effectCardConfig = config.getEffectCardConfigMap().get(cardId);
                        if (effectCardConfig == null) {
                            helper.setResult("狐妖卡牌无配置:" + cardId);
                            return;
                        }

                        gameLogic.addNewEffectCard(cardId, versionEffect);
                    }
                } else {
                    List<FoxSaleCard> foxSaleCards = config.randomEffectCard(gameData.getEffectCards(), 0, 1, -1, gameLogic.getCouponAddValue(eFoxCardCouponType.COUPON8.getValue()));
                    for (FoxSaleCard foxSaleCard : foxSaleCards) {
                        gameLogic.addNewEffectCard(foxSaleCard.getConfigId(), foxSaleCard.getVersionEffect());
                    }
                }
            } else if (cardType == eFoxCardType.HAND.getValue()) {
                int point = list.get(1);
                int color = list.get(2);
                int reinforceEffect = 0;
                int versionEffect = 0;
                int sealEffect = 0;
                if (list.size() > 3) {
                    reinforceEffect = list.get(3);
                    if (reinforceEffect > 0) {
                        FoxCardBuffConfig buffConfig = config.getBuffConfigMap().get(reinforceEffect);
                        if (buffConfig == null) {
                            helper.setResult("Buff找不到配置:" + reinforceEffect);
                            return;
                        }
                    }
                    versionEffect = list.get(4);
                    if (versionEffect > 0) {
                        FoxCardBuffConfig buffConfig = config.getBuffConfigMap().get(versionEffect);
                        if (buffConfig == null) {
                            helper.setResult("Buff找不到配置:" + versionEffect);
                            return;
                        }
                    }
                    sealEffect = list.get(5);
                    if (sealEffect > 0) {
                        FoxCardBuffConfig buffConfig = config.getBuffConfigMap().get(sealEffect);
                        if (buffConfig == null) {
                            helper.setResult("Buff找不到配置:" + sealEffect);
                            return;
                        }
                    }
                }

                gameLogic.addNewHandCard(point, color, reinforceEffect, versionEffect, sealEffect);
            } else if (cardType == eFoxCardType.MAGIC_WEAPON.getValue() || cardType == eFoxCardType.SPELL.getValue() || cardType == eFoxCardType.SORCERY.getValue()) {
                int configId = list.get(1);
                int versionEffect = 0;
                if (list.size() > 2) {
                    versionEffect = list.get(2);
                }
                if (versionEffect > 0) {
                    FoxCardBuffConfig buffConfig = config.getBuffConfigMap().get(versionEffect);
                    if (buffConfig == null) {
                        helper.setResult("Buff找不到配置:" + versionEffect);
                        return;
                    }
                }
                gameLogic.addNewConsumeCard(cardType, configId, versionEffect);
            }
            gameLogic.reCalcCardOpTimes();
            helper.setResult("狐妖添加卡牌");
        } else if (command.equals("/foxrehands")) {
            int comboId = 0;
            if (!StringUtils.isNullOrEmpty(param)) {
                comboId = Integer.valueOf(param);//从牌库里抽出指定的牌型
            }
            gameLogic.resetRemainHandCards();
            if (comboId == 0) {
                gameLogic.addHandCards();
            } else {

            }

            helper.setResult("重新随机发牌");
        } else if (command.equals("/foxgold")) {
            int gold = Integer.parseInt(param);
            gameData.setGold(gold);
            helper.setResult("设置金币为" + gold);
        } else if (command.equals("/foxcomboup")) {
            List<Integer> list = StringUtils.stringToIntegerList(param, "=");
            Integer comboId = list.get(0);
            Integer level = list.get(1);
            gameData.getComboInfoMap().get(comboId).set(0, level);
            helper.setResult("设置牌型等级");
        } else if (command.equals("/foxlabel")) {
            int labelId = Integer.parseInt(param);
            FoxCardLabelConfig labelConfig = config.getLabelConfigMap().get(labelId);
            if (labelConfig == null) {
                helper.setResult("赐福配置找不到:" + labelId);
                return;
            }
            gameData.getSkipLabelHaves().add(labelId);
            gameLogic.dealLabel(eFoxCardTriggerType.SKIP);
            helper.setResult("获得赐福");
        } else if (command.equals("/foxshowtimes")) {
            int times = Integer.valueOf(param);
            gameData.setShowCardTimes(times);
            helper.setResult("设置出牌次数");
        } else if (command.equals("/foxdroptimes")) {
            int times = Integer.valueOf(param);
            gameData.setDropCardTimes(times);
            helper.setResult("设置弃牌次数");
        } else if (command.equals("/foxcoupon")) {
            int couponId = Integer.valueOf(param);
            FoxCardCouponConfig couponConfig = config.getCouponConfigMap().get(couponId);
            if (couponConfig == null) {
                helper.setResult("优惠券找不到:" + couponId);
                return;
            }
            gameData.getCoupons().add(couponId);
            helper.setResult("获得优惠券");
        } else if (command.equals("/foxshopcoupon")) {
            int couponId = Integer.valueOf(param);
            FoxCardCouponConfig couponConfig = config.getCouponConfigMap().get(couponId);
            if (couponConfig == null) {
                helper.setResult("优惠券找不到:" + couponId);
                return;
            }
            FoxSaleCard coupon = new FoxSaleCard();
            coupon.setId(gameData.generalCardUniqueId());
            coupon.setConfigId(couponConfig.getId());
            coupon.setPrice(couponConfig.getGold());
            coupon.setType(eFoxCardType.COUPON.getValue());
            gameData.getShop().setCoupon(coupon);
            gameLogic.reCalcCardOpTimes();
            helper.setResult("设置商店优惠券");
        } else if (command.equals("/foxshopsale")) {
            List<Integer> list = StringUtils.stringToIntegerList(param, "=");
            int cardType = list.get(0);
            int cardId = list.get(1);
            if (gameData.getShop().getSaleCards().isEmpty()) {
                helper.setResult("没有在卖的商品");
                return;
            }
            if (cardType == eFoxCardType.EFFECT.getValue()) {
                FoxCardEffectCardConfig effectCardConfig = config.getEffectCardConfigMap().get(cardId);
                if (effectCardConfig == null) {
                    helper.setResult("狐妖卡牌无配置:" + cardId);
                    return;
                }
                int price = config.calcEffectCardPrice(effectCardConfig, 0);
            } else if (cardType == eFoxCardType.HAND.getValue()) {
                helper.setResult("不能设置成扑克牌:" + cardId);
                return;
            } else if (cardType == eFoxCardType.MAGIC_WEAPON.getValue()) {
                FoxCardMagicWeaponConfig weaponConfig = config.getMagicWeaponConfigMap().get(cardId);
                if (weaponConfig == null) {
                    helper.setResult("无配置:" + cardId);
                    return;
                }
            } else if (cardType == eFoxCardType.SPELL.getValue()) {
                FoxCardSpellConfig spellConfig = config.getSpellConfigMap().get(cardId);
                if (spellConfig == null) {
                    helper.setResult("无配置:" + cardId);
                    return;
                }
            } else if (cardType == eFoxCardType.SORCERY.getValue()) {
                FoxCardSorceryConfig sorceryConfig = config.getSorceryConfigMap().get(cardId);
                if (sorceryConfig == null) {
                    helper.setResult("无配置:" + cardId);
                    return;
                }
            }
            FoxSaleCard foxSaleCard = gameData.getShop().getSaleCards().get(0);
            if (foxSaleCard.getType() == eFoxCardType.HAND.getValue()) {
                helper.setResult("不能设置扑克牌");
                return;
            }
            foxSaleCard.setType(cardType);
            foxSaleCard.setConfigId(cardId);
            helper.setResult("设置商店第一个售卖牌");
        }  else if (command.equals("/foxshoppack")) {
            int packId = Integer.parseInt(param);
            FoxCardShopConfig foxCardShopConfig = config.getShopConfigMap().get(packId);
            if (foxCardShopConfig == null) {
                helper.setResult("无配置:" + packId);
                return;
            }
            FoxCardPack foxCardPack = gameData.getShop().getCardPacks().get(0);
            foxCardPack.setCardPackId(foxCardShopConfig.getId());
            foxCardPack.setPackType(foxCardPack.getPackType());
            helper.setResult("设置第一个卡包");
        } else if (command.equals("/foxbosslimit")) {
            int limitId = Integer.parseInt(param);
            UserFoxCardMonster monster = gameData.getMonsterMap().get(gameData.getRound());
            if (monster == null || monster.getBossLimitEffect() == 0) {
                helper.setResult("不在BOSS回合");
                return;
            }
            monster.setBossLimitEffect(limitId);
            gameData.setBossLimitEffect(limitId);
            gameLogic.reCalcCardOpTimes();
            helper.setResult("修改BOSS限制为:" + limitId);
        } else if (command.equals("/foxclearhands")) {//清空手牌
            gameData.getRemainHandCards().addAll(gameData.getHandCards());
            gameData.getHandCards().clear();
            helper.setResult("清空手牌");
        } else if (command.equals("/foxcleareffect")) {//清空小丑牌
            gameLogic.destroyEffectCards(gameData.getEffectCards());
            helper.setResult("清空小丑牌");
        } else if (command.equals("/foxexit")) {//放弃游戏
            player.sendPacket(GameProtocol.S_FOXCARD_EXIT_GAME, FoxCardProto.FoxCardExitGameReqMsg.newBuilder().setActivityId(config.getActivityId()));
            helper.setResult("放弃游戏");
        } else if (command.equals("/foxtest")) {
            for (FoxCardEffectCardConfig effectCardConfig : config.getEffectCardConfigMap().values()) {
                gameLogic.addNewEffectCard(effectCardConfig.getId(), 10012);
            }
            helper.setResult("加所有负片小丑牌");
        } else if (command.equals("/foxtree21")) {//把解签中的三张牌改成21点
            UserFoxCardData userData = player.getModule(FoxCardModule.class).getUserData();
            if (userData.getTreeCards().size() != 3) {
                helper.setResult("要刚好三张牌");
                return;
            }
            FoxTreeCard treeCard = userData.getTreeCards().get(0);
            treeCard.setPoint(5);
            treeCard = userData.getTreeCards().get(1);
            treeCard.setPoint(6);
            treeCard = userData.getTreeCards().get(2);
            treeCard.setPoint(10);
            userData.setUpdateOption();
            helper.setResult("解签中的牌设置为5 6 10");
        }else if (command.equals("/foxallcard")) {//解锁所有卡牌
            for (FoxCardEffectCardConfig cardConfig : config.getEffectCardConfigMap().values()) {
                player.getModule(FoxCardModule.class).getUserData().addUnlockCards(cardConfig.getId());
            }
            player.notifyListener(eGamePlayerEventType.FoxCardUnlockCard.getValue());
            player.notifyListener(eGamePlayerEventType.FoxCardOneCardUnlock.getValue());
            helper.setResult("解锁所有卡牌");
        }else if (command.equals("/foxequipcard")) {
            List<Integer> cardIds = StringUtils.stringToIntegerList(param, ",");
            player.getModule(FoxCardModule.class).getUserData().setEquipCards(cardIds);
            helper.setResult("装备指定卡牌");
        } else if (command.equals("/foxlottery")) {
            UserFoxCardData userData = new UserFoxCardData(config.getActivityId(), player.getUserId());
            int endPoint = Integer.valueOf(param);

            Map<Integer, Integer> resultMap = new HashMap<>();
            Map<Integer, Integer> cardNumMap = new HashMap<>();
            for (int lotteryNum = 0; lotteryNum < 1000000; lotteryNum++) {
                for (int j = 0; j < 20; j++) {
                    ArrayList<FoxTreeCard> newTreeCards = new ArrayList<>(userData.getTreeCards());
                    FoxTreeCard treeCard = config.autoLotteryTreeCard(newTreeCards, 1, endPoint, 1111, 0, userData.getUnlockCards(), userData.getGuaranteePoints());
                    if (treeCard == null) {
                        FoxCardLotterySettleConfig settleConfig = config.calcLotterySettleConfigBuyTotalPoint(userData.getTreeCards());
                        if (settleConfig.getRollType() != 0) {//可以结算的状态
                            resultMap.put(settleConfig.getId(), resultMap.getOrDefault(settleConfig.getId(), 0) + 1);
                            cardNumMap.put(settleConfig.getId(), cardNumMap.getOrDefault(settleConfig.getId(), 0) + newTreeCards.size());
                            userData.setTreeCards(new ArrayList<>());
                            break;
                        }
                    }
                    newTreeCards.add(treeCard);
                    userData.setTreeCards(newTreeCards);
                }
            }

            String content = "";
            for (Map.Entry<Integer, Integer> entry : resultMap.entrySet()) {
                Integer id = entry.getKey();
                int num = entry.getValue();
                BigDecimal avgValue = BigDecimal.valueOf(cardNumMap.getOrDefault(id, 0)).divide(BigDecimal.valueOf(num), 4, BigDecimal.ROUND_DOWN);
                content += "抽到" + id + "=" + num + "次," + "平均卡数=" + avgValue.toString() + ";";
            }

            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(),
                    content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            helper.setResult("测试小丑牌抽取");
        } else if (command.equals("/foxlotteryscore")) {
            List<Integer> inList = StringUtils.stringToIntegerList(param, "=");
            int endPoint = inList.get(0);
            int powerHave = inList.get(1);
            Map<Long, UserFoxCardData> testUserMap = new HashMap<>();

            Map<Integer, Integer> resultMap = new HashMap<>();
            Map<Integer, Integer> cardNumMap = new HashMap<>();
            int feiqiuNum = 0; //非酋次数统计

            Map<String, ActivityConfig> configMap = ActivityMgr.getActivityConfigMap(config.getActivityId());
            ActivityConfig randomPoolConfig = configMap.get("FOX_RECALL_POWER_GUARANTEES_NEW");//代码更新后,才说要加这种配置,只能这么写
            List<JSONObject> configPools = new ArrayList<>();
            if (randomPoolConfig != null) {
                //0,2;20|3;30|4;50|5;100|6;120|7;140|8;160|9;180|10;200#1000,2;20|3;30|4;50|5;100|6;120|7;140|8;160|9;180|10;200
                for (String s : randomPoolConfig.getValue().split("#")) {
                    List<String> list = StringUtils.stringToStringList(s, ",");
                    int minPower = Integer.valueOf(list.get(0));
                    Map<Integer, Integer> configRandomPool = new HashMap<>();
                    for (String s1 : list.get(1).split("\\|")) {
                        List<Integer> list1 = StringUtils.stringToIntegerList(s1, ";");
                        configRandomPool.put(list1.get(0), list1.get(1));
                    }
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("power", minPower);
                    jsonObject.put("pool", configRandomPool);
                    configPools.add(jsonObject);
                }
            }

            for (int userId = 1; userId <= 1000; userId++) {
                UserFoxCardData userData = new UserFoxCardData(config.getActivityId(), userId);
                testUserMap.put(userData.getUserId(), userData);

                userData.getUnlockCards().addAll(config.getInitEffectCardIds());

                userData.setPower(powerHave);
                userData.setGuaranteeAmount(config.getInitGuaranteeNum());
                FoxCardTreeLevelConfig treeLevelConfig = config.getTreeLevelConfig(userData.getTreeLevel());
                while (userData.getPower() >= treeLevelConfig.getRollConsume()) {
                    if (userData.getGuaranteeAmount() == -1) {
                        //先算玩家当前的每点体力对应的积分
                        BigDecimal perPowerScore = BigDecimal.valueOf(userData.getTreeScore()).divide(BigDecimal.valueOf(userData.getPowerAmount()), 8, BigDecimal.ROUND_UP);
                        //判断是否要进行动态权重计算
                        Map<Integer, Integer> randomPool = new HashMap<>();

                        for (JSONObject jsonObject : configPools) {
                            int comparePower = jsonObject.getIntValue("power");
                            Map<Integer, Integer> configRandomPool = jsonObject.getObject("pool", new TypeReference<Map<Integer, Integer>>() {
                            });
                            if (userData.getPowerAmount() >= comparePower) {
                                randomPool = configRandomPool;
                            }
                        }

                        if (perPowerScore.compareTo(config.getComparePowerScore()) < 0) {
                            feiqiuNum++;
                            /**
                             * y=a1*x^3+a2*x^2+a3*x+a4
                             * 参数均为千分比，即除以1000为实际值
                             *
                             * x=玩家当前积分/（当前消耗体力*平均单体力积分）
                             *
                             * 得出值均为权重值而非概率值，因为会存在0.001的误差可能性存在导致总和概率大于1或小于1
                             *
                             * 除2.3.4.5其余权重为0
                             */
                            BigDecimal x = perPowerScore.divide(BigDecimal.valueOf(config.getRecallCompareParams().get(0)), 8, RoundingMode.DOWN);
                            Map<Integer, Integer> balanceRandomPool = new HashMap<>();
                            for (Map.Entry<Integer, Integer> entry : randomPool.entrySet()) {
                                Integer num = entry.getKey();
                                List<Integer> list = config.getRecallBalanceParamsMap().get(num);
                                if (list != null) {
                                    int calcWeight = BigDecimal.valueOf(list.get(0)).multiply(BigDecimal.valueOf(Math.pow(x.doubleValue(), 3))).
                                            add(BigDecimal.valueOf(list.get(1)).multiply(BigDecimal.valueOf(Math.pow(x.doubleValue(), 2)))).
                                            add(BigDecimal.valueOf(list.get(2)).multiply(x)).
                                            add(BigDecimal.valueOf(list.get(3))).intValue();
                                    balanceRandomPool.put(num, calcWeight);
                                }
                            }
                            randomPool = balanceRandomPool;
                        }

                        int nextNum = config.getRandomHelper().getRandomKeyByWeightEx(randomPool);

                        userData.setGuaranteeAmount(nextNum);
                        //金色保底
                        if (userData.getGoldenGuaranteeAmount()+1 >= config.getGoldenGuaranteeNum()) {
                            userData.setGoldenGuarantee(true);
                            userData.setGoldenGuaranteeAmount(0);
                        }else {
                            int randomValue = config.getRandomHelper().next(1000);
                            if (randomValue < config.getGoldenRecallParams().get(0)) {
                                userData.setGoldenGuarantee(true);
                                userData.setGoldenGuaranteeAmount(0);
                            }else {
                                userData.setGoldenGuarantee(false);
                                userData.setGoldenGuaranteeAmount(userData.getGoldenGuaranteeAmount() + 1);
                            }
                        }
                    }

                    for (int j = 0; j < 20; j++) {
                        if (userData.getTreeCards().isEmpty()) {
                            userData.setLotteryRound(userData.getLotteryRound() + 1);
                            //本轮首抽,如果保底,获得保底组合
                            if (userData.getGuaranteePoints().isEmpty()) {
                                if (userData.getGuaranteeAmount() == 0 && config.getInitGuaranteeNum() > 0) {
                                    List<Integer> points = config.randomOnceTreeGuaranteeList();
                                    userData.setGuaranteePoints(points);
                                }
                            }
                        }
                        ArrayList<FoxTreeCard> newTreeCards = new ArrayList<>(userData.getTreeCards());
                        FoxTreeCard treeCard = config.autoLotteryTreeCard(newTreeCards, userData.getGuaranteeAmount(), endPoint, userData.getPowerAmount(),
                                userData.getLotteryRound(), userData.getUnlockCards(), userData.getGuaranteePoints());
                        if (treeCard == null) {
                            FoxCardLotterySettleConfig settleConfig = config.calcLotterySettleConfigBuyTotalPoint(userData.getTreeCards());
                            if (settleConfig.getRollType() != 0) {//可以结算的状态
                                resultMap.put(settleConfig.getId(), resultMap.getOrDefault(settleConfig.getId(), 0) + 1);
                                cardNumMap.put(settleConfig.getId(), cardNumMap.getOrDefault(settleConfig.getId(), 0) + newTreeCards.size());
                                userData.setTreeCards(new ArrayList<>());

                                int treeScoreAdd = 0;
                                for (FoxTreeCard treeCardHave : newTreeCards) {
                                    int score = config.getLotteryConfig(treeCardHave.getLotteryId()).getScore();
                                    treeScoreAdd += score;
                                }
                                treeLevelConfig = config.getTreeLevelConfig(userData.getTreeLevel());
                                int multi = settleConfig.getRewards().get(2); //积分倍率 千分比
                                int goldenMulti = 1000;
                                if (userData.getGuaranteeAmount() == 0 && userData.isGoldenGuarantee()) {//金色保底
                                    goldenMulti = config.getGoldenRecallParams().get(1);
                                }
                                BigDecimal levelMulti = BigDecimal.ONE;
                                ActivityConfig scoreMultiConfig = configMap.get("LEVEL_SCORE_PARAM");
                                if (scoreMultiConfig != null) {
                                    List<Integer> levelMultiList = StringUtils.stringToIntegerList(scoreMultiConfig.getValue(), "\\|");
                                    if (treeLevelConfig.getLevel() <= levelMultiList.size() && levelMultiList.size() > 0) {
                                        levelMulti = BigDecimal.valueOf(levelMultiList.get(treeLevelConfig.getLevel() - 1)).divide(BigDecimal.valueOf(1000));
                                    }
                                }
                                int score = BigDecimal.valueOf(treeScoreAdd).multiply(BigDecimal.valueOf(multi).divide(BigDecimal.valueOf(1000))).
                                        multiply(BigDecimal.valueOf(goldenMulti).divide(BigDecimal.valueOf(1000))).
                                        multiply(BigDecimal.valueOf(treeLevelConfig.getRollConsume())).
                                        multiply(levelMulti).intValue();
                                treeScoreAdd = score;
                                userData.setTreeScore(userData.getTreeScore() + treeScoreAdd);
                                int treeLevel = config.calcTreeLevel(userData.getTreeExp());
                                userData.setTreeLevel(treeLevel);

                                if (userData.getGuaranteeAmount() >= 0) {
                                    userData.setGuaranteeAmount(userData.getGuaranteeAmount() - 1);
                                }
                                userData.setGuaranteePoints(new ArrayList<>());

                                List<FoxTreeCard> resultList = new ArrayList<>();
                                Integer chooseType = settleConfig.getRewards().get(0);
                                int chooseNum = settleConfig.getRewards().get(1);
                                if (chooseType == 1) {//随机获得
                                    if (userData.getLotteryRound() < config.getUnlockGuaranteeNum()) {
                                        resultList = RandomHelper.getRandomList(newTreeCards, chooseNum);
                                    } else {
                                        newTreeCards.sort((o1, o2) -> {
                                            boolean isUnlock1 = userData.getUnlockCards().contains(o1.getCardId());
                                            boolean isUnlock2 = userData.getUnlockCards().contains(o2.getCardId());
                                            int compare = Boolean.compare(isUnlock1, isUnlock2);
                                            if (compare == 0) {
                                                int quality1 = config.getEffectCardConfigMap().get(o1.getCardId()).getQuality();
                                                int quality2 = config.getEffectCardConfigMap().get(o2.getCardId()).getQuality();
                                                compare = Integer.compare(quality2, quality1);
                                            }
                                            if (compare == 0) {
                                                compare = Integer.compare(o2.getPoint(), o1.getPoint());
                                            }
                                            return compare;
                                        });

                                        for (int i = 0; i < chooseNum; i++) {
                                            if (i >= newTreeCards.size()) {
                                                break;
                                            }
                                            resultList.add(newTreeCards.get(i));
                                        }
                                    }

                                } else if (chooseType == 2) {//手动选择
                                    //排序一下
                                    newTreeCards.sort((o1, o2) -> {
                                        boolean isUnlock1 = userData.getUnlockCards().contains(o1.getCardId());
                                        boolean isUnlock2 = userData.getUnlockCards().contains(o2.getCardId());
                                        int compare = Boolean.compare(isUnlock1, isUnlock2);
                                        if (compare == 0) {
                                            int quality1 = config.getEffectCardConfigMap().get(o1.getCardId()).getQuality();
                                            int quality2 = config.getEffectCardConfigMap().get(o2.getCardId()).getQuality();
                                            compare = Integer.compare(quality2, quality1);
                                        }
                                        if (compare == 0) {
                                            compare = Integer.compare(o2.getPoint(), o1.getPoint());
                                        }
                                        return compare;
                                    });

                                    for (int i = 0; i < chooseNum; i++) {
                                        if (i >= newTreeCards.size()) {
                                            break;
                                        }
                                        resultList.add(newTreeCards.get(i));
                                    }
                                }

                                for (FoxTreeCard foxTreeCard : resultList) {
                                    userData.getUnlockCards().add(foxTreeCard.getCardId());
                                }
                            }

                            break;
                        }
                        treeLevelConfig = config.getTreeLevelConfig(userData.getTreeLevel());
                        userData.setPower(userData.getPower() - treeLevelConfig.getRollConsume());
                        userData.setPowerAmount(userData.getPowerAmount() + treeLevelConfig.getRollConsume());

                        newTreeCards.add(treeCard);
                        userData.setTreeCards(newTreeCards);

                    }
                }
            }

            String content = endPoint + "点自动抽" + powerHave + "体力后;";
            long totalScore = 0;
            Map<Integer, Integer> qualityNumMap = new HashMap<>();//卡品质数量总和
            Map<Integer, Integer> qualityMinNumMap = new HashMap<>();//卡品质最少数量
            Map<Integer, Integer> qualityMaxNumMap = new HashMap<>();//卡品质最多数量
            long minScore = Long.MAX_VALUE;
            long maxScore = 0;
            List<UserFoxCardData> sortList = new ArrayList<>(testUserMap.values());
            sortList.sort((o1, o2) -> {
                return Integer.compare(o2.getTreeScore(), o1.getTreeScore());
            });
            long rankScore_250=0;
            long rankScore_750=0;
            long rankScore_500=0;
            for (int i = 0; i < sortList.size(); i++) {
                UserFoxCardData userFoxCardData = sortList.get(i);
                int rank = i+1;
                if (rank == 250){
                    rankScore_250=userFoxCardData.getTreeScore();
                }else if (rank == 500){
                    rankScore_500=userFoxCardData.getTreeScore();
                }else if (rank == 750){
                    rankScore_750=userFoxCardData.getTreeScore();
                }
//                content += "玩家" + userFoxCardData.getUserId() + " 积分=" + userFoxCardData.getTreeScore() + ",等级=" + userFoxCardData.getTreeLevel() + ",";
                totalScore += userFoxCardData.getTreeScore();

                Map<Integer, Integer> userQualityNumMap = new HashMap<>();
                for (Integer cardId : userFoxCardData.getUnlockCards()) {
                    int quality = config.getEffectCardConfigMap().get(cardId).getQuality();
                    userQualityNumMap.put(quality, userQualityNumMap.getOrDefault(quality, 0) + 1);
                    qualityNumMap.put(quality, qualityNumMap.getOrDefault(quality, 0) + 1);
                }
                for (Map.Entry<Integer, Integer> entry : userQualityNumMap.entrySet()) {
                    Integer quality = entry.getKey();
                    Integer cardNum = entry.getValue();
//                    content += "卡的品质" + quality + "=" + cardNum + "个,";
                }
//                content += ";";
                if (userFoxCardData.getTreeScore() > maxScore) {
                    maxScore = userFoxCardData.getTreeScore();
                }
                if (userFoxCardData.getTreeScore() < minScore) {
                    minScore = userFoxCardData.getTreeScore();
                }
            }
            String avgScore = BigDecimal.valueOf(totalScore).divide(BigDecimal.valueOf(testUserMap.size()), 4, BigDecimal.ROUND_DOWN).toString();
            content += "平均积分=" + avgScore + ";";
            content += "最大积分=" + maxScore + ";";
            content += "最小积分=" + minScore + ";";
            content += "第250名积分=" + rankScore_250 + ";";
            content += "第500名积分=" + rankScore_500 + ";";
            content += "第750名积分=" + rankScore_750 + ";";
            content += "非酋触发次数=" + feiqiuNum + ";";
            for (Map.Entry<Integer, Integer> entry : qualityNumMap.entrySet()) {
                Integer quality = entry.getKey();
                Integer cardNum = entry.getValue();
                String avgCardNum = BigDecimal.valueOf(cardNum).divide(BigDecimal.valueOf(testUserMap.size()), 4, BigDecimal.ROUND_DOWN).toString();
                content += "品质" + quality + "平均解锁数量=" + avgCardNum + ";";
            }

            for (Map.Entry<Integer, Integer> entry : resultMap.entrySet()) {
                Integer id = entry.getKey();
                int num = entry.getValue();
                BigDecimal avgValue = BigDecimal.valueOf(cardNumMap.getOrDefault(id, 0)).divide(BigDecimal.valueOf(num), 4, BigDecimal.ROUND_DOWN);
                content += "抽到" + id + "=" + num + "次," + "平均卡数=" + avgValue.toString() + ";";
            }
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(),
                    content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            helper.setResult("测试小丑牌抽取积分获得");
        } else if (command.equals("/foxlotteryallcard")) { //抽出所有卡需要多少体力
            int endPoint = Integer.valueOf(param);
            Map<Long, UserFoxCardData> testUserMap = new HashMap<>();
            for (int userId = 1; userId <= 1000; userId++) {
                UserFoxCardData userData = new UserFoxCardData(config.getActivityId(), userId);
                testUserMap.put(userData.getUserId(), userData);

                userData.getUnlockCards().addAll(config.getInitEffectCardIds());

                FoxCardTreeLevelConfig treeLevelConfig = config.getTreeLevelConfig(userData.getTreeLevel());
                while (userData.getUnlockCards().size() < config.getEffectCardConfigMap().size()) {
                    for (int j = 0; j < 20; j++) {
                        if (userData.getTreeCards().isEmpty()) {
                            userData.setLotteryRound(userData.getLotteryRound() + 1);
                        }
                        ArrayList<FoxTreeCard> newTreeCards = new ArrayList<>(userData.getTreeCards());
                        FoxTreeCard treeCard = config.autoLotteryTreeCard(newTreeCards, userData.getGuaranteeAmount(), endPoint, userData.getPowerAmount(), userData.getLotteryRound(), userData.getUnlockCards(), userData.getGuaranteePoints());
                        if (treeCard == null) {
                            FoxCardLotterySettleConfig settleConfig = config.calcLotterySettleConfigBuyTotalPoint(userData.getTreeCards());
                            if (settleConfig.getRollType() != 0) {//可以结算的状态
                                userData.setTreeCards(new ArrayList<>());

                                int treeScoreAdd = 0;
                                for (FoxTreeCard treeCardHave : newTreeCards) {
                                    int score = config.getLotteryConfig(treeCardHave.getLotteryId()).getScore();
                                    treeScoreAdd += score;
                                }
                                treeLevelConfig = config.getTreeLevelConfig(userData.getTreeLevel());
                                int multi = settleConfig.getRewards().get(2); //积分倍率 千分比
                                int score = treeScoreAdd * multi * treeLevelConfig.getRollConsume() / 1000;
                                treeScoreAdd = score;
                                userData.setTreeScore(userData.getTreeScore() + treeScoreAdd);


                                List<FoxTreeCard> resultList = new ArrayList<>();
                                Integer chooseType = settleConfig.getRewards().get(0);
                                int chooseNum = settleConfig.getRewards().get(1);
                                if (chooseType == 1) {//随机获得
                                    if (userData.getLotteryRound() < config.getUnlockGuaranteeNum()) {
                                        resultList = RandomHelper.getRandomList(newTreeCards, chooseNum);
                                    } else {
                                        newTreeCards.sort((o1, o2) -> {
                                            boolean isUnlock1 = userData.getUnlockCards().contains(o1.getCardId());
                                            boolean isUnlock2 = userData.getUnlockCards().contains(o2.getCardId());
                                            int compare = Boolean.compare(isUnlock1, isUnlock2);
                                            if (compare == 0) {
                                                int quality1 = config.getEffectCardConfigMap().get(o1.getCardId()).getQuality();
                                                int quality2 = config.getEffectCardConfigMap().get(o2.getCardId()).getQuality();
                                                compare = Integer.compare(quality2, quality1);
                                            }
                                            if (compare == 0) {
                                                compare = Integer.compare(o2.getPoint(), o1.getPoint());
                                            }
                                            return compare;
                                        });

                                        for (int i = 0; i < chooseNum; i++) {
                                            if (i >= newTreeCards.size()) {
                                                break;
                                            }
                                            resultList.add(newTreeCards.get(i));
                                        }
                                    }

                                } else if (chooseType == 2) {//手动选择
                                    //排序一下
                                    newTreeCards.sort((o1, o2) -> {
                                        boolean isUnlock1 = userData.getUnlockCards().contains(o1.getCardId());
                                        boolean isUnlock2 = userData.getUnlockCards().contains(o2.getCardId());
                                        int compare = Boolean.compare(isUnlock1, isUnlock2);
                                        if (compare == 0) {
                                            int quality1 = config.getEffectCardConfigMap().get(o1.getCardId()).getQuality();
                                            int quality2 = config.getEffectCardConfigMap().get(o2.getCardId()).getQuality();
                                            compare = Integer.compare(quality2, quality1);
                                        }
                                        if (compare == 0) {
                                            compare = Integer.compare(o2.getPoint(), o1.getPoint());
                                        }
                                        return compare;
                                    });

                                    for (int i = 0; i < chooseNum; i++) {
                                        if (i >= newTreeCards.size()) {
                                            break;
                                        }
                                        resultList.add(newTreeCards.get(i));
                                    }
                                }

                                for (FoxTreeCard foxTreeCard : resultList) {
                                    userData.getUnlockCards().add(foxTreeCard.getCardId());
                                }
                            }
                            break;
                        } else {
                            treeLevelConfig = config.getTreeLevelConfig(userData.getTreeLevel());
                            userData.setPower(userData.getPower() + treeLevelConfig.getRollConsume());

                            newTreeCards.add(treeCard);
                            userData.setTreeCards(newTreeCards);

                            int treeLevel = config.calcTreeLevel(userData.getTreeExp());
                            userData.setTreeLevel(treeLevel);
                        }
                    }
                }
            }

            String content = endPoint + "点自动抽解锁所有卡;";
            int totalScore = 0;
            int totalPower = 0;
            int totalRound = 0;
            for (UserFoxCardData userFoxCardData : testUserMap.values()) {
//                content += "玩家" + userFoxCardData.getUserId() + "使用体力=" + userFoxCardData.getPower() +
//                        ",抽取轮次=" + userFoxCardData.getLotteryRound() +
//                        ",积分=" + userFoxCardData.getTreeScore() +
//                        ",等级=" + userFoxCardData.getTreeLevel() +
//                        ";";
                totalScore += userFoxCardData.getTreeScore();
                totalPower += userFoxCardData.getPower();
                totalRound += userFoxCardData.getLotteryRound();
            }
            String avgScore = BigDecimal.valueOf(totalScore).divide(BigDecimal.valueOf(testUserMap.size()), 4, BigDecimal.ROUND_DOWN).toString();
            content += "平均积分=" + avgScore + ";";
            String avgPower = BigDecimal.valueOf(totalPower).divide(BigDecimal.valueOf(testUserMap.size()), 4, BigDecimal.ROUND_DOWN).toString();
            content += "平均体力=" + avgPower + ";";
            String avgRound = BigDecimal.valueOf(totalRound).divide(BigDecimal.valueOf(testUserMap.size()), 4, BigDecimal.ROUND_DOWN).toString();
            content += "平均轮次=" + avgRound + ";";
            WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.WorldChat.getValue(), eChatContentType.Common.getContentType(),
                    content, DateHelper.getCurrentTime(), 0, "");
            player.sendPacket(ClientProtocol.U_WORLD_MESSAGE_SYNC, msg);
            helper.setResult("测试小丑牌抽取解锁所有卡的花费");
        }

        gameData.setUpdateOption();
    }

    private static void hotpotJump(GamePlayer player, CommandHelper helper) {
        String command = helper.getCommand();
        String param = helper.getParam();
        if (!command.startsWith("/jump")) {
            return;
        }

        HotpotJumpConfig config = HotpotJumpMgr.getConfig();
        if (config == null) {
            return;
        }
        HotpotJumpModule jumpModule = player.getModule(HotpotJumpModule.class);
        UserHotpotJumpGameData userGameData = jumpModule.getUserGameData();
        HotpotJumpGameLogic logic = new HotpotJumpGameLogic(config, userGameData);
        if (command.equals("/jumpprintf")) {
            String content = logic.printfBoard();
            helper.setResult("打印棋盘");
            return;
        }

        if (command.equals("/jumprole")) {
            List<Integer> list = StringUtils.stringToIntegerList(param, ",");
            int x = list.get(0);
            int y = list.get(1);

            JumpBoardGrid grid = logic.board.findGrid(x, y);
            if (grid == null) {
                helper.setResult("坐标" + x + "," + y + "不在盘面上");
                return;
            }
            HotpotJumpUnit unitByGrid = logic.findUnitByGrid(grid);
            if (unitByGrid != null) {
                helper.setResult("当前位置有怪=" + unitByGrid.getConfigId());
                return;
            }

            userGameData.getMainRole().getGrid().setX(x);
            userGameData.getMainRole().getGrid().setY(y);

            helper.setResult("移动到" + x + "," + y);
            return;
        }

        if (command.equals("/jumpinit")) {
            UserHotpotJumpGameData gameData = logic.initGame();
            userGameData.copy(gameData);
            helper.setResult("游戏重新开始");
            return;
        }

        if (command.equals("/jumpunit")) {
            int createNum = Integer.parseInt(param);
            logic.createNewUnitsByU(createNum);
            userGameData.copy(logic.getGameData());
            helper.setResult("生成" + createNum + "个新单位");
            return;
        }

        if (command.equals("/jumpjoinunit")) {
            List<Integer> list = StringUtils.stringToIntegerList(param, ",");
            int modelId = list.get(0);
            int lv = list.get(1);
            int exp = list.get(2);
            int x = list.get(3);
            int y = list.get(4);
            JumpBoardGrid emptyGrid = logic.board.findGrid(x, y);
            List<Integer> attrs = config.calcUnitAtkAndHp(config.getModelConfigById(modelId), lv);
            HotpotJumpUnit jumpUnit = logic.createJumpUnit(modelId, lv, exp, attrs.get(1), attrs.get(0), emptyGrid);
            jumpUnit.setId(logic.getGameData().generalUnitUniqueId());
            logic.joinUnit(jumpUnit, true);
            userGameData.copy(logic.getGameData());
            helper.setResult("指定位置加入");
            return;
        }

        if (command.equals("/jumpboss")) {
            List<Integer> list = StringUtils.stringToIntegerList(param, "=");
            int bossId = list.get(0);
            int bossLevel = 50;
            if (list.size() > 1) {
                bossLevel = list.get(1);
            }

            if (list.size() > 3) {
                int x = list.get(2);
                int y = list.get(3);
                JumpBoardGrid bornGrid = logic.board.findGrid(x, y);
                HotpotJumpModelConfig modelConfigById = config.getModelConfigById(bossId);
                HotpotJumpUnit boss = logic.createBoss(bornGrid, modelConfigById, bossLevel, 0);
                logic.killUnitByBossBody(boss);
                logic.joinUnit(boss, true);
            } else {
                logic.createAndJoinBoss(bossId, bossLevel);
            }

            userGameData.copy(logic.getGameData());

            helper.setResult("生成" + bossLevel + "级Boss" + bossId);
            return;
        }

        if (command.equals("/jumpskill")) {
            logic.getGameData().getMainRole().setSkills(new ArrayList<>());//清空原有技能
            List<Integer> list = StringUtils.stringToIntegerList(param, ",");
            for (Integer skillId : list) {
                logic.skillChoose(skillId, false, false);
            }
            logic.reCalcMainRoleAttr();

            userGameData.copy(logic.getGameData());

            helper.setResult("清空原有技能,获得技能" + param);
            return;
        }

        if (command.equals("/jumpskill2")) {
            logic.getGameData().getMainRole().setSkills(new ArrayList<>());//清空原有技能
            List<Integer> list = StringUtils.stringToIntegerList(param, ",");
            int skillId = list.get(0);
            int skillLv = list.get(1);
            for (int i = 0; i < skillLv; i++) {
                logic.getGameData().getMainRole().addSkillId(skillId);
            }

            logic.reCalcMainRoleAttr();

            userGameData.copy(logic.getGameData());

            helper.setResult("清空原有技能,获得技能" + param);
            return;
        }

        if (command.equals("/jumpaction")) {

            logic.unitAction();
            userGameData.copy(logic.getGameData());

            helper.setResult("敌方行动");
            return;
        }

        if (command.equals("/jumpboard")) {
            logic.initGameByStr(param);
            userGameData.copy(logic.getGameData());

            helper.setResult("指定盘面");
            return;
        }

        if (command.equals("/jumprandomskill")) {
            List<Integer> skillIds = StringUtils.stringToIntegerList(param, ",");
//            List<Integer> skillIds = config.randomMainRoleSkill(userGameData.getMainRole().getSkills(), userGameData.isPractice());
            userGameData.setSkillIds(skillIds);
            helper.setResult("随机技能");
            return;
        }

        if (command.equals("/jumpsetlv")) {
            int lv = Integer.parseInt(param);
            userGameData.getMainRole().setLv(lv);
            helper.setResult("设置主角等级为" + lv);
            return;
        }

        if (command.equals("/jumpsetexp")) {
            int exp = Integer.parseInt(param);
            userGameData.getMainRole().setExp(exp);
            helper.setResult("设置主角总经验为" + exp);
            return;
        }

        if (command.equals("/jumphpmax")) {

            userGameData.getMainRole().getGrid().setHp(9999999);
            userGameData.getMainRole().getGrid().setHpMax(9999999);

            for (HotpotJumpUnit unit : userGameData.getUnits()) {
                unit.getHeadPos().setHp(9999999);
                unit.getHeadPos().setHpMax(9999999);
            }

            helper.setResult("设置所有单位血量为" + 9999999);
            return;
        }

        if (command.equals("/jumprecommend")) {
            List<JumpBoardGrid> grids = logic.calcRecommendPath(logic.getGameData().getMainRole().getGrid().getX(), logic.getGameData().getMainRole().getGrid().getY());
            helper.setResult("计算推荐跳跃点");
            return;
        }

        if (command.equals("/jumpskillshow")) {
            //225#2,5|4,5|7,5|5,4#6,5|5,3|3,7#1
            String[] split = param.split("#");
            int hp = Integer.parseInt(split[0]);
            List<String> roleJump = StringUtils.stringToStringList(split[2], "\\|");
            int skillId = Integer.parseInt(split[3]);

            logic.initGameByStr(split[1]);
            logic.getGameData().getMainRole().addSkillId(skillId);
            for (HotpotJumpUnit unit : logic.getGameData().getUnits()) {
                unit.getHeadPos().setHpMax(hp);
                unit.getHeadPos().setHp(hp);
            }

            List<HotpotJumpProto.HotpotJumpGuideMsg> tempGuideMsgList = new ArrayList<>();
            {//初始盘面
                HotpotJumpProto.HotpotJumpGuideMsg.Builder builder = HotpotJumpProto.HotpotJumpGuideMsg.newBuilder();
                builder.setGame(HotpotJumpPb.parseGameDataBuilder(logic.getGameData()));
                tempGuideMsgList.add(builder.build());
            }

            {//移动
                logic = new HotpotJumpGameLogic(config, logic.getGameData());
                List<HotpotJumpProto.HotpotJumpGridTemp> moveList = new ArrayList<>();
                for (String s : roleJump) {
                    List<Integer> list = StringUtils.stringToIntegerList(s, ",");
                    int x = list.get(0);
                    int y = list.get(1);
                    HotpotJumpProto.HotpotJumpGridTemp.Builder moveTemp = HotpotJumpProto.HotpotJumpGridTemp.newBuilder();
                    moveTemp.setX(x);
                    moveTemp.setY(y);
                    moveList.add(moveTemp.build());
                }
                int ret = logic.jump(moveList, false, false);
                if (ret != 0) {
                    helper.setResult("技能演示移动失败");
                    return;
                }

                HotpotJumpProto.HotpotJumpGuideMsg.Builder builder = HotpotJumpProto.HotpotJumpGuideMsg.newBuilder();
                builder.setGame(HotpotJumpPb.parseGameDataBuilder(logic.getGameData()));
                builder.addAllShows(HotpotJumpPb.parseShowListBuilder(logic.getShowList()));
                tempGuideMsgList.add(builder.build());
            }

            HotpotJumpProto.HotpotJumpGetGuideMsgRespMsg.Builder resp = HotpotJumpProto.HotpotJumpGetGuideMsgRespMsg.newBuilder();
            resp.setRet(0);
            resp.addAllGuide(tempGuideMsgList);

            player.sendPacket(GameProtocol.S_HOTPOT_JUMP_GET_GUIDE_MSG % 20000, resp);

            helper.setResult("生成技能演示数据");
            return;
        }
    }

    private static class CommandHelper {
        private String command;
        private String param;

        private boolean finish;

        private String result = "";

        public CommandHelper(String content) {
            List<String> contentSplit = StringUtils.stringToStringList(content, " ");
            // 命令
            String command = "";
            // 参数
            String param = "";
            if (contentSplit.size() > 0) {
                command = contentSplit.get(0);
                if (contentSplit.size() > 1) {
                    param = contentSplit.get(1);
                }
            }
            this.command = command;
            this.param = param;
        }

        public String getCommand() {
            return command;
        }

        public void setCommand(String command) {
            this.command = command;
        }

        public String getParam() {
            return param;
        }

        public void setParam(String param) {
            this.param = param;
        }

        public boolean isFinish() {
            return finish;
        }

        public void setFinish(boolean finish) {
            this.finish = finish;
        }

        public String getResult() {
            return result;
        }

        public void setResult(String result) {
            this.finish = true;
            this.result = result;
        }
    }


}
